From fad1befb90425b931c0412c2ad5998b989231854 Mon Sep 17 00:00:00 2001 From: acanas Date: Fri, 26 Feb 2021 23:13:06 +0100 Subject: [PATCH] Version 20.36.3: Feb 26, 2021 Query moved to module swad_timeline_database. --- swad_changelog.h | 3 ++- swad_timeline_comment.c | 9 +-------- swad_timeline_database.c | 19 +++++++++++++++++++ swad_timeline_database.h | 3 +++ 4 files changed, 25 insertions(+), 9 deletions(-) diff --git a/swad_changelog.h b/swad_changelog.h index 21da0e62..421b860d 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.36.2 (2021-02-26)" +#define Log_PLATFORM_VERSION "SWAD 20.36.3 (2021-02-26)" #define CSS_FILE "swad20.33.9.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.36.3: Feb 26, 2021 Query moved to module swad_timeline_database. (305140 lines) Version 20.36.2: Feb 26, 2021 Query moved to module swad_timeline_database. (305126 lines) Version 20.36.1: Feb 26, 2021 Function moved to module swad_timeline_database. (305113 lines) Version 20.36: Feb 26, 2021 New module swad_timeline_database. (305133 lines) diff --git a/swad_timeline_comment.c b/swad_timeline_comment.c index 59e6646d..81cb2aa7 100644 --- a/swad_timeline_comment.c +++ b/swad_timeline_comment.c @@ -727,14 +727,7 @@ static long TL_Com_ReceiveComment (void) TL_Pub_PublishPubInTimeline (&Pub); // Set Pub.PubCod /* Insert comment content in the database */ - DB_QueryINSERT ("can not store comment content", - "INSERT INTO tl_comments" - " (PubCod,Txt,MedCod)" - " VALUES" - " (%ld,'%s',%ld)", - Pub.PubCod, - Content.Txt, - Content.Media.MedCod); + TL_DB_InsertCommentContent (Pub.PubCod,&Content); /***** Store notifications about the new comment *****/ Ntf_StoreNotifyEventsToAllUsrs (Ntf_EVENT_TIMELINE_COMMENT,Pub.PubCod); diff --git a/swad_timeline_database.c b/swad_timeline_database.c index 9d9730fe..7238c5e2 100644 --- a/swad_timeline_database.c +++ b/swad_timeline_database.c @@ -27,6 +27,7 @@ #include "swad_database.h" #include "swad_timeline.h" +#include "swad_timeline_database.h" #include "swad_timeline_publication.h" /*****************************************************************************/ @@ -117,3 +118,21 @@ unsigned TL_DB_GetFinalComments (long NotCod, NotCod,(unsigned) TL_Pub_COMMENT_TO_NOTE, NumFinalCommentsToGet); } + +/*****************************************************************************/ +/******************* Insert comment content in database **********************/ +/*****************************************************************************/ + +void TL_DB_InsertCommentContent (long PubCod, + const struct TL_Pst_PostContent *Content) + { + /***** Insert comment content in database *****/ + DB_QueryINSERT ("can not store comment content", + "INSERT INTO tl_comments" + " (PubCod,Txt,MedCod)" + " VALUES" + " (%ld,'%s',%ld)", + PubCod, + Content->Txt, + Content->Media.MedCod); + } diff --git a/swad_timeline_database.h b/swad_timeline_database.h index be59440a..c990d5a8 100644 --- a/swad_timeline_database.h +++ b/swad_timeline_database.h @@ -28,6 +28,7 @@ /*****************************************************************************/ #include "swad_database.h" +#include "swad_timeline_post.h" /*****************************************************************************/ /****************************** Public constants *****************************/ @@ -48,5 +49,7 @@ unsigned TL_DB_GetInitialComments (long NotCod, unsigned TL_DB_GetFinalComments (long NotCod, unsigned NumFinalCommentsToGet, MYSQL_RES **mysql_res); +void TL_DB_InsertCommentContent (long PubCod, + const struct TL_Pst_PostContent *Content); #endif