Version 15.102.2

This commit is contained in:
Antonio Cañas Vargas 2016-01-08 10:13:28 +01:00
parent d00a425ed0
commit 36a89ae8ba
4 changed files with 69 additions and 8 deletions

View File

@ -38,6 +38,7 @@
#include "swad_notification.h"
#include "swad_parameter.h"
#include "swad_profile.h"
#include "swad_social.h"
/*****************************************************************************/
/****************************** Public constants *****************************/
@ -784,6 +785,9 @@ void Acc_CompletelyEliminateAccount (struct UsrData *UsrDat,
UsrDat->UsrCod);
DB_QueryDELETE (Query,"can not remove sessions of a user");
/***** Remove social content associated to the user *****/
Soc_RemoveUsrSocialContent (UsrDat->UsrCod);
/***** Remove user's figures *****/
Prf_RemoveUsrFigures (UsrDat->UsrCod);

View File

@ -113,24 +113,19 @@
// TODO: Forum SWAD should be always named "SWAD"?
// TODO: Enable chat for guests?
// TODO: Go to forum post (or at least to forum thread) from social timeline?
// TODO: When a social publishing is removed, but it is shared, author should be warned about it
// TODO: Consider the possibility of remove all the publishing of a social note when the author removes it
/*
Escribir social note después de compartir, descompartir o eliminar como antes, completa arriba y siempre tras el mensaje,
excepto cuando se elimina del todo tras descompartir/eliminar, sólo en ese caso no pintar nada.
En definitiva, se estará pintando simplemente una copia arriba de lo que hay más abajo en el timeline.
*/
/*****************************************************************************/
/****************************** Public constants *****************************/
/*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 15.102.1 (2016-01-08)"
#define Log_PLATFORM_VERSION "SWAD 15.102.2 (2016-01-08)"
#define CSS_FILE "swad15.102.css"
#define JS_FILE "swad15.100.2.js"
// Number of lines (includes comments but not blank lines) has been got with the following command:
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h sql/swad*.sql | tail -1
/*
Version 15.102.2: Jan 08, 2016 When a user is eliminated, all her/his social publshing are removed. (191606 lines)
Version 15.102.1: Jan 08, 2016 Changes in layout of social timeline. (191557 lines)
Version 15.102: Jan 08, 2016 Remove a comment in social timeline. (191534 lines)
4 changes necessary in database:

View File

@ -2205,6 +2205,66 @@ static void Soc_RemoveASocialCommentFromDB (struct SocialComment *SocCom)
Soc_ResetSocialComment (SocCom);
}
/*****************************************************************************/
/******************* Remove a social note from database **********************/
/*****************************************************************************/
void Soc_RemoveUsrSocialContent (long UsrCod)
{
char Query[512];
/***** Remove social comments *****/
/* Remove content of all the comments in all the social notes of the user */
sprintf (Query,"DELETE FROM social_comments_content"
" USING social_comments,social_comments_content"
" WHERE social_comments.NotCod IN"
" (SELECT NotCod FROM social_notes WHERE UsrCod='%ld')"
" AND social_comments.ComCod=social_comments_content.ComCod",
UsrCod);
DB_QueryDELETE (Query,"can not remove social comments");
/* Remove all the comments in all the social notes of the user */
sprintf (Query,"DELETE FROM social_comments"
" WHERE NotCod IN"
" (SELECT NotCod FROM social_notes WHERE UsrCod='%ld')",
UsrCod);
DB_QueryDELETE (Query,"can not remove social comments");
/* Remove content of all the comments of the user in any social note */
sprintf (Query,"DELETE FROM social_comments_content"
" USING social_comments,social_comments_content"
" WHERE social_comments.UsrCod='%ld'"
" AND social_comments.ComCod=social_comments_content.ComCod",
UsrCod);
DB_QueryDELETE (Query,"can not remove social comments");
/* Remove all the comments of the user in any social note */
sprintf (Query,"DELETE FROM social_comments"
" WHERE UsrCod='%ld'",
UsrCod);
DB_QueryDELETE (Query,"can not remove social comments");
/***** Remove all the social posts of the user *****/
sprintf (Query,"DELETE FROM social_posts"
" WHERE PstCod IN"
" (SELECT Cod FROM social_notes"
" WHERE UsrCod='%ld' AND NoteType='%u')",
UsrCod,(unsigned) Soc_NOTE_SOCIAL_POST);
DB_QueryDELETE (Query,"can not remove social posts");
/***** Remove all the social publishings of the user *****/
sprintf (Query,"DELETE FROM social_timeline"
" WHERE AuthorCod='%ld' OR PublisherCod='%ld'",
UsrCod,UsrCod);
DB_QueryDELETE (Query,"can not remove social publishings");
/***** Remove all the social notes of the user *****/
sprintf (Query,"DELETE FROM social_notes"
" WHERE UsrCod='%ld'",
UsrCod);
DB_QueryDELETE (Query,"can not remove social notes");
}
/*****************************************************************************/
/**************** Check if a user has published a social note ****************/
/*****************************************************************************/

View File

@ -113,4 +113,6 @@ void Soc_RequestRemSocialComUsr (void);
void Soc_RemoveSocialComGbl (void);
void Soc_RemoveSocialComUsr (void);
void Soc_RemoveUsrSocialContent (long UsrCod);
#endif