From a32ed57305e9d09dd268ee6431d6e39437c3f981 Mon Sep 17 00:00:00 2001 From: acanas Date: Mon, 1 Mar 2021 14:12:18 +0100 Subject: [PATCH] Version 20.36.43: Mar 01, 2021 Query moved to module swad_timeline_database. --- swad_changelog.h | 3 ++- swad_timeline_database.c | 15 +++++++++++++++ swad_timeline_database.h | 1 + swad_timeline_user.c | 18 ++++++++---------- 4 files changed, 26 insertions(+), 11 deletions(-) diff --git a/swad_changelog.h b/swad_changelog.h index a1858efa..19dbe461 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.42 (2021-03-01)" +#define Log_PLATFORM_VERSION "SWAD 20.36.43 (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.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) Version 20.36.41: Mar 01, 2021 Query moved to module swad_timeline_database. (305466 lines) Version 20.36.40: Mar 01, 2021 Query moved to module swad_timeline_database. (305457 lines) diff --git a/swad_timeline_database.c b/swad_timeline_database.c index dd99ac17..55ddc770 100644 --- a/swad_timeline_database.c +++ b/swad_timeline_database.c @@ -913,6 +913,21 @@ void TL_DB_UpdateFirstLastPubCodsInSession (long FirstPubCod) Gbl.Session.Id); } +/*****************************************************************************/ +/********** Remove all publications of any user authored by a user ***********/ +/*****************************************************************************/ + +void TL_DB_RemoveAllPubsOfAnyUsrAuthoredBy (long UsrCod) + { + /***** Remove all publications of any user authored by the user *****/ + DB_QueryDELETE ("can not remove publications", + "DELETE FROM tl_pubs" + " USING tl_notes,tl_pubs" + " WHERE tl_notes.UsrCod=%ld" + " AND tl_notes.NotCod=tl_pubs.NotCod", + UsrCod); + } + /*****************************************************************************/ /********************* Remove all publications of a user *********************/ /*****************************************************************************/ diff --git a/swad_timeline_database.h b/swad_timeline_database.h index c0938427..d50cbe2e 100644 --- a/swad_timeline_database.h +++ b/swad_timeline_database.h @@ -114,6 +114,7 @@ long TL_DB_CreateNewPub (const struct TL_Pub_Publication *Pub); void TL_DB_UpdateFirstPubCodInSession (long FirstPubCod); void TL_DB_UpdateLastPubCodInSession (void); void TL_DB_UpdateFirstLastPubCodsInSession (long FirstPubCod); +void TL_DB_RemoveAllPubsOfAnyUsrAuthoredBy (long UsrCod); void TL_DB_RemoveAllPubsUsr (long UsrCod); /****************************** Favourites ***********************************/ diff --git a/swad_timeline_user.c b/swad_timeline_user.c index 88783de6..c71c85eb 100644 --- a/swad_timeline_user.c +++ b/swad_timeline_user.c @@ -132,21 +132,19 @@ void TL_Usr_RemoveUsrContent (long UsrCod) " AND tl_pubs.PubCod=tl_comments.PubCod", UsrCod,(unsigned) TL_Pub_COMMENT_TO_NOTE); - /***** Remove all posts of the user *****/ + /***** Remove posts *****/ + /* Remove all posts of the user */ TL_DB_RemoveAllPostsUsr (UsrCod); - /***** Remove all publications of any user authored by the user *****/ - DB_QueryDELETE ("can not remove publications", - "DELETE FROM tl_pubs" - " USING tl_notes,tl_pubs" - " WHERE tl_notes.UsrCod=%ld" - " AND tl_notes.NotCod=tl_pubs.NotCod", - UsrCod); + /***** Remove publications *****/ + /* Remove all publications of any user authored by the user */ + TL_DB_RemoveAllPubsOfAnyUsrAuthoredBy (UsrCod); - /***** Remove all the publications of the user *****/ + /* Remove all the publications of the user */ TL_DB_RemoveAllPubsUsr (UsrCod); - /***** Remove all notes of the user *****/ + /***** Remove notes *****/ + /* Remove all notes of the user */ TL_DB_RemoveAllNotesUsr (UsrCod); }