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

This commit is contained in:
acanas 2021-03-01 15:23:18 +01:00
parent df6dfc270b
commit 3cad8a3f0a
4 changed files with 50 additions and 35 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.44 (2021-03-01)"
#define Log_PLATFORM_VERSION "SWAD 20.36.45 (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.45: Mar 01, 2021 Queries moved to module swad_timeline_database. (305528 lines)
Version 20.36.44: Mar 01, 2021 Query moved to module swad_timeline_database. (305516 lines)
Version 20.36.43: Mar 01, 2021 Query moved to module swad_timeline_database. (305489 lines)
Version 20.36.42: Mar 01, 2021 Query moved to module swad_timeline_database. (305476 lines)

View File

@ -614,6 +614,39 @@ void TL_DB_RemoveCommentPub (long PubCod)
(unsigned) TL_Pub_COMMENT_TO_NOTE);
}
/*****************************************************************************/
/*********** Remove all comments in all the notes of a given user ************/
/*****************************************************************************/
void TL_DB_RemoveAllCommentsInAllNotesOf (long UsrCod)
{
/***** Remove all comments in all notes of the user *****/
DB_QueryDELETE ("can not remove comments",
"DELETE FROM tl_comments"
" USING tl_notes,tl_pubs,tl_comments"
" WHERE tl_notes.UsrCod=%ld"
" AND tl_notes.NotCod=tl_pubs.NotCod"
" AND tl_pubs.PubType=%u"
" AND tl_pubs.PubCod=tl_comments.PubCod",
UsrCod,(unsigned) TL_Pub_COMMENT_TO_NOTE);
}
/*****************************************************************************/
/*********** Remove all comments made by a given user in any note ************/
/*****************************************************************************/
void TL_DB_RemoveAllCommentsMadeBy (long UsrCod)
{
/***** Remove all comments made by this user in any note *****/
DB_QueryDELETE ("can not remove comments",
"DELETE FROM tl_comments"
" USING tl_pubs,tl_comments"
" WHERE tl_pubs.PublisherCod=%ld"
" AND tl_pubs.PubType=%u"
" AND tl_pubs.PubCod=tl_comments.PubCod",
UsrCod,(unsigned) TL_Pub_COMMENT_TO_NOTE);
}
/*****************************************************************************/
/*************** Get code of media associated to post/comment ****************/
/*****************************************************************************/
@ -919,14 +952,15 @@ void TL_DB_UpdateFirstLastPubCodsInSession (long FirstPubCod)
}
/*****************************************************************************/
/** Remove all publications published by any user & authored by a given user */
/************** Remove all publications published by any user ****************/
/************** related to notes authored by a given user ****************/
/*****************************************************************************/
void TL_DB_RemoveAllPubsPublishedByAnyUsrOfNotesAuthoredBy (long UsrCod)
{
/***** Remove all publications (original or shared notes)
/***** Remove all publications (original notes, shared notes, comments)
published by any user
of notes authored by this user *****/
and related to notes authored by this user *****/
DB_QueryDELETE ("can not remove publications",
"DELETE FROM tl_pubs"
" USING tl_notes,tl_pubs"
@ -1040,7 +1074,7 @@ void TL_DB_UnmarkAsFav (TL_Fav_WhatToFav_t WhatToFav,long Cod)
void TL_DB_RemoveAllFavsMadeByUsr (TL_Fav_WhatToFav_t WhatToFav,long UsrCod)
{
/* Remove all favs made by this user to any comment */
/* Remove all favs made by this user to any note/comment */
DB_QueryDELETE ("can not remove favs",
"DELETE FROM %s WHERE UsrCod=%ld",
TL_DB_Table[WhatToFav],UsrCod);

View File

@ -94,6 +94,8 @@ long TL_DB_GetMedCodFromComment (long PubCod);
void TL_DB_RemoveCommentFavs (long PubCod);
void TL_DB_RemoveCommentContent (long PubCod);
void TL_DB_RemoveCommentPub (long PubCod);
void TL_DB_RemoveAllCommentsInAllNotesOf (long UsrCod);
void TL_DB_RemoveAllCommentsMadeBy (long UsrCod);
/****************************** Publications *********************************/
void TL_DB_CreateSubQueryPublishers (const struct TL_Timeline *Timeline,

View File

@ -30,7 +30,6 @@
#include <linux/limits.h> // For PATH_MAX
#include <stdio.h> // For asprintf
#include "swad_database.h"
#include "swad_global.h"
#include "swad_photo.h"
#include "swad_timeline.h"
@ -79,48 +78,27 @@ void TL_Usr_RemoveUsrContent (long UsrCod)
TL_DB_RemoveAllFavsToAllCommentsInAllNotesBy (UsrCod);
/***** Remove favs for notes *****/
/* Remove all favs made by this user in any note */
/* Remove all favs made by this user to any note */
TL_DB_RemoveAllFavsMadeByUsr (TL_Fav_NOTE,UsrCod);
/* Remove all favs to notes of this user */
TL_DB_RemoveAllFavsToPubsBy (TL_Fav_NOTE,UsrCod);
/***** Remove comments *****/
/* Remove content of all comments in all the notes of the user */
DB_QueryDELETE ("can not remove comments",
"DELETE FROM tl_comments"
" USING tl_notes,tl_pubs,tl_comments"
" WHERE tl_notes.UsrCod=%ld"
" AND tl_notes.NotCod=tl_pubs.NotCod"
" AND tl_pubs.PubType=%u"
" AND tl_pubs.PubCod=tl_comments.PubCod",
UsrCod,(unsigned) TL_Pub_COMMENT_TO_NOTE);
/* Remove all comments in all the notes of this user */
TL_DB_RemoveAllCommentsInAllNotesOf (UsrCod);
/* Remove all comments from any user in any note of the user */
DB_QueryDELETE ("can not remove comments",
"DELETE FROM tl_pubs"
" USING tl_notes,tl_pubs"
" WHERE tl_notes.UsrCod=%ld"
" AND tl_notes.NotCod=tl_pubs.NotCod"
" AND tl_pubs.PubType=%u",
UsrCod,(unsigned) TL_Pub_COMMENT_TO_NOTE);
/* Remove content of all comments of the user in any note */
DB_QueryDELETE ("can not remove comments",
"DELETE FROM tl_comments"
" USING tl_pubs,tl_comments"
" WHERE tl_pubs.PublisherCod=%ld"
" AND tl_pubs.PubType=%u"
" AND tl_pubs.PubCod=tl_comments.PubCod",
UsrCod,(unsigned) TL_Pub_COMMENT_TO_NOTE);
/* Remove all comments made by this user in any note */
TL_DB_RemoveAllCommentsMadeBy (UsrCod);
/***** Remove posts *****/
/* Remove all posts of the user */
TL_DB_RemoveAllPostsUsr (UsrCod);
/***** Remove publications *****/
/* Remove all publications (original or shared notes) published by any user
of notes authored by the user */
/* Remove all publications (original, shared notes, comments)
published by any user
and related to notes authored by the user */
TL_DB_RemoveAllPubsPublishedByAnyUsrOfNotesAuthoredBy (UsrCod);
/* Remove all publications published by the user */