diff --git a/swad_changelog.h b/swad_changelog.h index a83a26e81..656624ec4 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.25 (2021-02-28)" +#define Log_PLATFORM_VERSION "SWAD 20.36.26 (2021-02-28)" #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.26: Feb 28, 2021 Queries moved to module swad_timeline_database. (305423 lines) Version 20.36.25: Feb 28, 2021 Queries moved to module swad_timeline_database. (305405 lines) Version 20.36.24: Feb 28, 2021 Functions moved to module swad_timeline_database. (305385 lines) Version 20.36.23: Feb 28, 2021 Function moved to module swad_timeline_database. (305387 lines) diff --git a/swad_timeline_database.c b/swad_timeline_database.c index 0a8aadbf4..5df03d536 100644 --- a/swad_timeline_database.c +++ b/swad_timeline_database.c @@ -879,3 +879,30 @@ void TL_DB_MarkCommAsFav (long PubCod) PubCod, Gbl.Usrs.Me.UsrDat.UsrCod); } + +/*****************************************************************************/ +/********************* Unmark note as favourite in database ******************/ +/*****************************************************************************/ + +void TL_DB_UnmarkNoteAsFav (long NotCod) + { + /***** Delete the mark as favourite from database *****/ + DB_QueryDELETE ("can not unfavourite note", + "DELETE FROM tl_notes_fav" + " WHERE NotCod=%ld AND UsrCod=%ld", + NotCod, + Gbl.Usrs.Me.UsrDat.UsrCod); + } + +/*****************************************************************************/ +/******************* Unmark comment as favourite in database *****************/ +/*****************************************************************************/ + +void TL_DB_UnmarkCommAsFav (long PubCod) + { + DB_QueryDELETE ("can not unfavourite comment", + "DELETE FROM tl_comments_fav" + " WHERE PubCod=%ld AND UsrCod=%ld", + PubCod, + Gbl.Usrs.Me.UsrDat.UsrCod); + } diff --git a/swad_timeline_database.h b/swad_timeline_database.h index 7d51f6cb4..4aeaf98e4 100644 --- a/swad_timeline_database.h +++ b/swad_timeline_database.h @@ -113,5 +113,7 @@ void TL_DB_UpdateFirstLastPubCodsInSession (long FirstPubCod); /****************************** Favourites ***********************************/ void TL_DB_MarkNoteAsFav (long NotCod); void TL_DB_MarkCommAsFav (long PubCod); +void TL_DB_UnmarkNoteAsFav (long NotCod); +void TL_DB_UnmarkCommAsFav (long PubCod); #endif diff --git a/swad_timeline_favourite.c b/swad_timeline_favourite.c index 9c7c56d55..54c66ede1 100644 --- a/swad_timeline_favourite.c +++ b/swad_timeline_favourite.c @@ -206,11 +206,7 @@ static void TL_Fav_UnfNote (struct TL_Not_Note *Not) Gbl.Usrs.Me.UsrDat.UsrCod)) // I have favourited the note { /***** Delete the mark as favourite from database *****/ - DB_QueryDELETE ("can not unfavourite note", - "DELETE FROM tl_notes_fav" - " WHERE NotCod=%ld AND UsrCod=%ld", - Not->NotCod, - Gbl.Usrs.Me.UsrDat.UsrCod); + TL_DB_UnmarkNoteAsFav (Not->NotCod); /***** Update number of times this note is favourited *****/ TL_Fav_GetNumTimesANoteHasBeenFav (Not); @@ -351,11 +347,7 @@ static void TL_Fav_UnfComment (struct TL_Com_Comment *Com) Gbl.Usrs.Me.UsrDat.UsrCod)) // I have favourited the comment { /***** Delete the mark as favourite from database *****/ - DB_QueryDELETE ("can not unfavourite comment", - "DELETE FROM tl_comments_fav" - " WHERE PubCod=%ld AND UsrCod=%ld", - Com->PubCod, - Gbl.Usrs.Me.UsrDat.UsrCod); + TL_DB_UnmarkCommAsFav (Com->PubCod); /***** Update number of times this comment is favourited *****/ TL_Fav_GetNumTimesACommHasBeenFav (Com);