From da0ad8065316bab1c09a8b672950bf5cd3b11857 Mon Sep 17 00:00:00 2001 From: acanas Date: Mon, 15 Feb 2021 23:58:48 +0100 Subject: [PATCH] Version 20.32.1: Feb 15, 2021 Fixed bug in forums. --- swad_changelog.h | 7 ++++--- swad_forum.c | 23 +++++++++++------------ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/swad_changelog.h b/swad_changelog.h index 0634d9405..2cd3e2c80 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.32 (2021-02-15)" +#define Log_PLATFORM_VERSION "SWAD 20.32.1 (2021-02-15)" #define CSS_FILE "swad20.8.css" #define JS_FILE "swad20.6.2.js" /* @@ -601,8 +601,9 @@ 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.32: Feb 15, 2021 Fixed bug in copy of strings. - Code refactoring in copy. (304755 lines) + Version 20.32.1: Feb 15, 2021 Fixed bug in forums. (304756 lines) + Version 20.32: Feb 15, 2021 Fixed bugs in copy of strings. + Code refactoring in copy of strings. (304755 lines) Version 20.31: Feb 15, 2021 Code refactoring in copy, concat and sprintf. (304811 lines) Version 20.30.1: Feb 14, 2021 Code refactoring in timeline related to temporary tables. (305883 lines) Version 20.30: Feb 11, 2021 Code refactoring in hierarchy. (305853 lines) diff --git a/swad_forum.c b/swad_forum.c index 972ae4aad..126fec081 100644 --- a/swad_forum.c +++ b/swad_forum.c @@ -371,13 +371,13 @@ static long For_WriteLinksToCrsForums (const struct For_Forums *Forums, long CrsCod,bool IsLastCrs, bool IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS]); static void For_WriteLinkToForum (const struct For_Forums *Forums, - struct For_Forum *Forum, + const struct For_Forum *Forum, bool Highlight, unsigned Level, bool IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS]); -static unsigned For_GetNumThrsWithNewPstsInForum (struct For_Forum *Forum, +static unsigned For_GetNumThrsWithNewPstsInForum (const struct For_Forum *Forum, unsigned NumThreads); -static unsigned For_GetNumOfThreadsInForumNewerThan (struct For_Forum *Forum, +static unsigned For_GetNumOfThreadsInForumNewerThan (const struct For_Forum *Forum, const char *Time); static unsigned For_GetNumOfUnreadPostsInThr (long ThrCod,unsigned NumPostsInThr); static unsigned For_GetNumOfPostsInThrNewerThan (long ThrCod,const char *Time); @@ -387,7 +387,7 @@ static void For_ShowForumThreadsHighlightingOneThread (struct For_Forums *Forums Ale_AlertType_t AlertType,const char *Message); static void For_PutIconNewThread (void *Forums); static void For_PutAllHiddenParamsNewThread (void *Forums); -static unsigned For_GetNumThrsInForum (struct For_Forum *Forum); +static unsigned For_GetNumThrsInForum (const struct For_Forum *Forum); static void For_ListForumThrs (struct For_Forums *Forums, long ThrCods[Pag_ITEMS_PER_PAGE], long ThrCodHighlighted, @@ -407,7 +407,7 @@ static void For_PutAllHiddenParamsRemThread (void *Forums); static bool For_CheckIfICanMoveThreads (void); static long For_GetThrInMyClipboard (void); -static bool For_CheckIfThrBelongsToForum (long ThrCod,struct For_Forum *Forum); +static bool For_CheckIfThrBelongsToForum (long ThrCod,const struct For_Forum *Forum); static void For_MoveThrToCurrentForum (const struct For_Forums *Forums); static void For_InsertThrInClipboard (long ThrCod); static void For_RemoveExpiredThrsClipboards (void); @@ -2038,7 +2038,7 @@ static long For_WriteLinksToCrsForums (const struct For_Forums *Forums, /*****************************************************************************/ static void For_WriteLinkToForum (const struct For_Forums *Forums, - struct For_Forum *Forum, + const struct For_Forum *Forum, bool Highlight, unsigned Level, bool IsLastItemInLevel[1 + For_FORUM_MAX_LEVELS]) @@ -2253,7 +2253,7 @@ void For_SetForumName (const struct For_Forum *Forum, /***** Get number of threads with new posts since my last read of a forum ****/ /*****************************************************************************/ -static unsigned For_GetNumThrsWithNewPstsInForum (struct For_Forum *Forum, +static unsigned For_GetNumThrsWithNewPstsInForum (const struct For_Forum *Forum, unsigned NumThreads) { char SubQuery[256]; @@ -2268,14 +2268,13 @@ static unsigned For_GetNumThrsWithNewPstsInForum (struct For_Forum *Forum, else SubQuery[0] = '\0'; NumRows = DB_QuerySELECT (&mysql_res,"can not get the date of reading of a forum", - "SELECT MAX(forum_thr_read.ReadTime)" + "SELECT IFNULL(MAX(forum_thr_read.ReadTime),FROM_UNIXTIME(0))" " FROM forum_thr_read,forum_thread" " WHERE forum_thr_read.UsrCod=%ld" " AND forum_thr_read.ThrCod=forum_thread.ThrCod" " AND forum_thread.ForumType=%u%s", Gbl.Usrs.Me.UsrDat.UsrCod, (unsigned) Forum->Type,SubQuery); - if (NumRows) { /***** Get number of threads with a last message modify time > newest read time (row[0]) *****/ @@ -2293,7 +2292,7 @@ static unsigned For_GetNumThrsWithNewPstsInForum (struct For_Forum *Forum, /**** Get number of threads in forum with a modify time > a specified time ***/ /*****************************************************************************/ -static unsigned For_GetNumOfThreadsInForumNewerThan (struct For_Forum *Forum, +static unsigned For_GetNumOfThreadsInForumNewerThan (const struct For_Forum *Forum, const char *Time) { char SubQuery[256]; @@ -3006,7 +3005,7 @@ unsigned For_GetNumTotalThrsInForumsOfType (For_ForumType_t ForumType, /******************* Get number of threads in a forum ************************/ /*****************************************************************************/ -static unsigned For_GetNumThrsInForum (struct For_Forum *Forum) +static unsigned For_GetNumThrsInForum (const struct For_Forum *Forum) { char SubQuery[256]; @@ -4350,7 +4349,7 @@ static long For_GetThrInMyClipboard (void) /***************** Get if a thread belongs to current forum ******************/ /*****************************************************************************/ -static bool For_CheckIfThrBelongsToForum (long ThrCod,struct For_Forum *Forum) +static bool For_CheckIfThrBelongsToForum (long ThrCod,const struct For_Forum *Forum) { char SubQuery[256];