Version 20.36.39: Mar 01, 2021 Queries moved to module swad_timeline_database.

This commit is contained in:
acanas 2021-03-01 13:52:24 +01:00
parent 220bc5de39
commit b381e8322c
5 changed files with 19 additions and 10 deletions

View File

@ -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.38 (2021-03-01)"
#define Log_PLATFORM_VERSION "SWAD 20.36.39 (2021-03-01)"
#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.39: Mar 01, 2021 Queries moved to module swad_timeline_database. (? lines)
Version 20.36.38: Mar 01, 2021 Code refactoring in timeline notifications. (305441 lines)
Version 20.36.37: Mar 01, 2021 Query moved to module swad_timeline_database. (305449 lines)
Version 20.36.36: Mar 01, 2021 Query moved to module swad_timeline_database. (305429 lines)

View File

@ -973,6 +973,18 @@ void TL_DB_UnmarkAsFav (TL_Fav_WhatToFav_t WhatToFav,long Cod)
TL_DB_Field[WhatToFav],Cod,Gbl.Usrs.Me.UsrDat.UsrCod);
}
/*****************************************************************************/
/************* Remove all favs made by this user in any comment **************/
/*****************************************************************************/
void TL_DB_RemoveAllFavsMadeByUsr (TL_Fav_WhatToFav_t WhatToFav,long UsrCod)
{
/* Remove all favs made by this user in any comment */
DB_QueryDELETE ("can not remove favs",
"DELETE FROM %s WHERE UsrCod=%ld",
TL_DB_Table[WhatToFav],UsrCod);
}
/*****************************************************************************/
/****************** Check if a user has published a note *********************/
/*****************************************************************************/

View File

@ -124,6 +124,7 @@ unsigned TL_DB_GetListUsrsHaveFaved (TL_Fav_WhatToFav_t WhatToFav,
MYSQL_RES **mysql_res);
void TL_DB_MarkAsFav (TL_Fav_WhatToFav_t WhatToFav,long Cod);
void TL_DB_UnmarkAsFav (TL_Fav_WhatToFav_t WhatToFav,long Cod);
void TL_DB_RemoveAllFavsMadeByUsr (TL_Fav_WhatToFav_t WhatToFav,long UsrCod);
/******************************** Shared *************************************/
bool TL_DB_CheckIfNoteIsSharedByUsr (long NotCod,long UsrCod);

View File

@ -28,7 +28,6 @@
#include <stdbool.h> // For boolean type
#include <string.h> // For string functions
#include "swad_database.h"
#include "swad_global.h"
#include "swad_timeline.h"
#include "swad_timeline_database.h"

View File

@ -34,6 +34,8 @@
#include "swad_global.h"
#include "swad_photo.h"
#include "swad_timeline.h"
#include "swad_timeline_database.h"
#include "swad_timeline_favourite.h"
#include "swad_timeline_note.h"
#include "swad_timeline_publication.h"
#include "swad_timeline_user.h"
@ -68,10 +70,7 @@ void TL_Usr_RemoveUsrContent (long UsrCod)
{
/***** Remove favs for comments *****/
/* Remove all favs made by this user in any comment */
DB_QueryDELETE ("can not remove favs",
"DELETE FROM tl_comments_fav"
" WHERE UsrCod=%ld",
UsrCod);
TL_DB_RemoveAllFavsMadeByUsr (TL_Fav_COMM,UsrCod);
/* Remove all favs for all comments of this user */
DB_QueryDELETE ("can not remove favs",
@ -94,10 +93,7 @@ void TL_Usr_RemoveUsrContent (long UsrCod)
/***** Remove favs for notes *****/
/* Remove all favs made by this user in any note */
DB_QueryDELETE ("can not remove favs",
"DELETE FROM tl_notes_fav"
" WHERE UsrCod=%ld",
UsrCod);
TL_DB_RemoveAllFavsMadeByUsr (TL_Fav_NOTE,UsrCod);
/* Remove all favs for all notes of this user */
DB_QueryDELETE ("can not remove favs",