diff --git a/swad_changelog.h b/swad_changelog.h index 44d9e8f14..a5209d3cf 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -553,7 +553,7 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - * En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 20.26 (2021-02-11)" +#define Log_PLATFORM_VERSION "SWAD 20.26.1 (2021-02-11)" #define CSS_FILE "swad20.8.css" #define JS_FILE "swad20.6.2.js" /* @@ -601,6 +601,7 @@ TODO: DNI de un estudiante sale err TODO: BUG: Cuando un tipo de grupo sólo tiene un grupo, inscribirse es voluntario, el estudiante sólo puede pertenecer a un grupo, y se inscribe en él, debería poder desapuntarse. Ahora no puede. TODO: Salvador Romero Cortés: @acanas opción para editar posts + Version 20.26.1: Feb 11, 2021 Code refactoring in timeline. (305504 lines) Version 20.26: Feb 11, 2021 New module swad_timeline_who. (305540 lines) Version 20.25: Feb 11, 2021 New module swad_timeline_publication. (305440 lines) Version 20.24: Feb 11, 2021 Code refactoring in timeline. New linked list to hold publications. (305354 lines) diff --git a/swad_timeline.c b/swad_timeline.c index 685a6dbb6..15ce42a14 100644 --- a/swad_timeline.c +++ b/swad_timeline.c @@ -28,22 +28,14 @@ #define _GNU_SOURCE // For asprintf #include // For PATH_MAX #include // For asprintf -#include // For malloc and free -#include // For string functions -#include // For time_t #include "swad_database.h" -#include "swad_exam_announcement.h" #include "swad_figure.h" -#include "swad_follow.h" -#include "swad_form.h" -#include "swad_forum.h" #include "swad_global.h" #include "swad_message.h" -#include "swad_notice.h" +#include "swad_notification.h" #include "swad_photo.h" #include "swad_profile.h" -#include "swad_setting.h" #include "swad_timeline.h" #include "swad_timeline_favourite.h" #include "swad_timeline_note.h" @@ -857,33 +849,6 @@ static long TL_ReceivePost (void) return Pub.NotCod; } -/*****************************************************************************/ -/*************** Get code of publication of the original note ****************/ -/*****************************************************************************/ - -long TL_Not_GetPubCodOfOriginalNote (long NotCod) - { - MYSQL_RES *mysql_res; - MYSQL_ROW row; - long OriginalPubCod = -1L; - - /***** Get code of publication of the original note *****/ - if (DB_QuerySELECT (&mysql_res,"can not get code of publication", - "SELECT PubCod FROM tl_pubs" - " WHERE NotCod=%ld AND PubType=%u", - NotCod,(unsigned) TL_PUB_ORIGINAL_NOTE) == 1) // Result should have a unique row - { - /* Get code of publication (row[0]) */ - row = mysql_fetch_row (mysql_res); - OriginalPubCod = Str_ConvertStrCodToLongCod (row[0]); - } - - /***** Free structure that stores the query result *****/ - DB_FreeMySQLResult (&mysql_res); - - return OriginalPubCod; - } - /*****************************************************************************/ /************* Remove all the content of a user from database ****************/ /*****************************************************************************/ diff --git a/swad_timeline_note.c b/swad_timeline_note.c index fd65de40a..9a24874ff 100644 --- a/swad_timeline_note.c +++ b/swad_timeline_note.c @@ -1239,6 +1239,33 @@ static void TL_Not_ResetNote (struct TL_Not_Note *Not) Not->NumShared = 0; } +/*****************************************************************************/ +/*************** Get code of publication of the original note ****************/ +/*****************************************************************************/ + +long TL_Not_GetPubCodOfOriginalNote (long NotCod) + { + MYSQL_RES *mysql_res; + MYSQL_ROW row; + long OriginalPubCod = -1L; + + /***** Get code of publication of the original note *****/ + if (DB_QuerySELECT (&mysql_res,"can not get code of publication", + "SELECT PubCod FROM tl_pubs" + " WHERE NotCod=%ld AND PubType=%u", + NotCod,(unsigned) TL_PUB_ORIGINAL_NOTE) == 1) // Result should have a unique row + { + /* Get code of publication (row[0]) */ + row = mysql_fetch_row (mysql_res); + OriginalPubCod = Str_ConvertStrCodToLongCod (row[0]); + } + + /***** Free structure that stores the query result *****/ + DB_FreeMySQLResult (&mysql_res); + + return OriginalPubCod; + } + /*****************************************************************************/ /****** Add just retrieved notes to current timeline for this session ********/ /*****************************************************************************/ diff --git a/swad_timeline_note.h b/swad_timeline_note.h index 96934c829..209393681 100644 --- a/swad_timeline_note.h +++ b/swad_timeline_note.h @@ -115,10 +115,10 @@ void TL_Not_RequestRemNoteGbl (void); void TL_Not_RemoveNoteUsr (void); void TL_Not_RemoveNoteGbl (void); -void TL_Not_AddNotesJustRetrievedToTimelineThisSession (void); - long TL_Not_GetPubCodOfOriginalNote (long NotCod); +void TL_Not_AddNotesJustRetrievedToTimelineThisSession (void); + void TL_Not_GetDataOfNoteByCod (struct TL_Not_Note *Not); void TL_Not_ClearOldTimelinesNotesFromDB (void); diff --git a/swad_timeline_publication.c b/swad_timeline_publication.c index fb9b3638e..f7357fe5f 100644 --- a/swad_timeline_publication.c +++ b/swad_timeline_publication.c @@ -25,25 +25,12 @@ /*********************************** Headers *********************************/ /*****************************************************************************/ -#define _GNU_SOURCE // For asprintf -#include // For PATH_MAX -#include // For asprintf #include // For malloc and free #include // For string functions -#include // For time_t #include "swad_database.h" -#include "swad_exam_announcement.h" -#include "swad_figure.h" -#include "swad_follow.h" -#include "swad_form.h" -#include "swad_forum.h" #include "swad_global.h" -#include "swad_message.h" -#include "swad_notice.h" -#include "swad_photo.h" #include "swad_profile.h" -#include "swad_setting.h" #include "swad_timeline.h" #include "swad_timeline_favourite.h" #include "swad_timeline_note.h" diff --git a/swad_timeline_who.c b/swad_timeline_who.c index 8f39ccd69..5217c4937 100644 --- a/swad_timeline_who.c +++ b/swad_timeline_who.c @@ -25,30 +25,13 @@ /*********************************** Headers *********************************/ /*****************************************************************************/ -#define _GNU_SOURCE // For asprintf -#include // For PATH_MAX -#include // For asprintf -#include // For malloc and free -#include // For string functions -#include // For time_t - #include "swad_database.h" -#include "swad_exam_announcement.h" -#include "swad_figure.h" #include "swad_follow.h" -#include "swad_form.h" -#include "swad_forum.h" #include "swad_global.h" -#include "swad_message.h" -#include "swad_notice.h" -#include "swad_photo.h" -#include "swad_profile.h" +#include "swad_parameter.h" #include "swad_setting.h" #include "swad_timeline.h" -#include "swad_timeline_favourite.h" -#include "swad_timeline_note.h" -#include "swad_timeline_publication.h" -#include "swad_timeline_share.h" +#include "swad_timeline_who.h" /*****************************************************************************/ /****************************** Public constants *****************************/