diff --git a/swad_changelog.h b/swad_changelog.h index 271a818f..a1858efa 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.41 (2021-03-01)" +#define Log_PLATFORM_VERSION "SWAD 20.36.42 (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.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) Version 20.36.39: Mar 01, 2021 Queries moved to module swad_timeline_database. (305448 lines) diff --git a/swad_timeline_database.c b/swad_timeline_database.c index 406c9579..dd99ac17 100644 --- a/swad_timeline_database.c +++ b/swad_timeline_database.c @@ -411,6 +411,21 @@ void TL_DB_RemovePost (long PstCod) PstCod); } +/*****************************************************************************/ +/************************* Remove all posts of a user ************************/ +/*****************************************************************************/ + +void TL_DB_RemoveAllPostsUsr (long UsrCod) + { + /***** Remove all posts of the user *****/ + DB_QueryDELETE ("can not remove posts", + "DELETE FROM tl_posts" + " WHERE PstCod IN" + " (SELECT Cod FROM tl_notes" + " WHERE UsrCod=%ld AND NoteType=%u)", + UsrCod,(unsigned) TL_NOTE_POST); + } + /*****************************************************************************/ /********************* Get number of comments in a note **********************/ /*****************************************************************************/ diff --git a/swad_timeline_database.h b/swad_timeline_database.h index 10a6f8f5..c0938427 100644 --- a/swad_timeline_database.h +++ b/swad_timeline_database.h @@ -76,6 +76,7 @@ unsigned TL_DB_GetPostByCod (long PstCod,MYSQL_RES **mysql_res); long TL_DB_GetMedCodFromPost (long PubCod); long TL_DB_CreateNewPost (const struct TL_Pst_PostContent *Content); void TL_DB_RemovePost (long PstCod); +void TL_DB_RemoveAllPostsUsr (long UsrCod); /******************************** Comments ***********************************/ unsigned TL_DB_GetNumCommentsInNote (long NotCod); diff --git a/swad_timeline_user.c b/swad_timeline_user.c index b8380296..88783de6 100644 --- a/swad_timeline_user.c +++ b/swad_timeline_user.c @@ -104,7 +104,7 @@ void TL_Usr_RemoveUsrContent (long UsrCod) UsrCod); /***** Remove comments *****/ - /* Remove content of all the comments in all the notes of the user */ + /* 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" @@ -114,7 +114,7 @@ void TL_Usr_RemoveUsrContent (long UsrCod) " AND tl_pubs.PubCod=tl_comments.PubCod", UsrCod,(unsigned) TL_Pub_COMMENT_TO_NOTE); - /* Remove all the comments from any user in any note of the user */ + /* 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" @@ -123,7 +123,7 @@ void TL_Usr_RemoveUsrContent (long UsrCod) " AND tl_pubs.PubType=%u", UsrCod,(unsigned) TL_Pub_COMMENT_TO_NOTE); - /* Remove content of all the comments of the user in any 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" @@ -132,15 +132,10 @@ void TL_Usr_RemoveUsrContent (long UsrCod) " AND tl_pubs.PubCod=tl_comments.PubCod", UsrCod,(unsigned) TL_Pub_COMMENT_TO_NOTE); - /***** Remove all the posts of the user *****/ - DB_QueryDELETE ("can not remove posts", - "DELETE FROM tl_posts" - " WHERE PstCod IN" - " (SELECT Cod FROM tl_notes" - " WHERE UsrCod=%ld AND NoteType=%u)", - UsrCod,(unsigned) TL_NOTE_POST); + /***** Remove all posts of the user *****/ + TL_DB_RemoveAllPostsUsr (UsrCod); - /***** Remove all the publications of any user authored by the user *****/ + /***** 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"