Version 15.121.6

This commit is contained in:
Antonio Cañas Vargas 2016-01-20 14:29:42 +01:00
parent 1b6f41c46c
commit 9f68c620d8
2 changed files with 47 additions and 12 deletions

View File

@ -119,19 +119,19 @@
// TODO: Increment one second after each refresh in social timeline?
// TODO: Notifications of new followers should go to follower's profile
// TODO: Fav comments (remove favs when comment is removed)
/*****************************************************************************/
/****************************** Public constants *****************************/
/*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 15.121.5 (2016-01-20)"
#define Log_PLATFORM_VERSION "SWAD 15.121.6 (2016-01-20)"
#define CSS_FILE "swad15.121.5.css"
#define JS_FILE "swad15.118.4.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.121.6: Jan 20, 2016 Remove favs when a social comment is removed.
Remove favs when a user is removed. (193953 lines)
Version 15.121.5: Jan 20, 2016 New layout of form to write a new social comment. (193922 lines)
Version 15.121.4: Jan 20, 2016 Fixed bug related to favs in social comments. (193904 lines)
Version 15.121.3: Jan 20, 2016 Favs in social comments. Not finished.

View File

@ -3356,6 +3356,15 @@ static void Soc_RemoveASocialNoteFromDB (struct SocialNote *SocNot)
{
char Query[256];
/***** Remove favs for all comments in this note *****/
sprintf (Query,"DELETE FROM social_comments_fav"
" USING social_notes,social_comments,social_comments_fav"
" WHERE social_notes.NotCod='%ld'"
" AND social_notes.ComCod=social_comments.ComCod"
" AND social_comments.ComCod=social_comments_fav.ComCod",
SocNot->NotCod);
DB_QueryDELETE (Query,"can not remove favs for social note");
/***** Remove favs for this note *****/
sprintf (Query,"DELETE FROM social_notes_fav WHERE NotCod='%ld'",
SocNot->NotCod);
@ -3544,9 +3553,13 @@ static void Soc_RemoveASocialCommentFromDB (struct SocialComment *SocCom)
{
char Query[128];
/***** Remove favs for this comment *****/
sprintf (Query,"DELETE FROM social_comments_fav WHERE ComCod='%ld'",
SocCom->ComCod);
DB_QueryDELETE (Query,"can not remove favs for social comment");
/***** Remove content of this social comment *****/
sprintf (Query,"DELETE FROM social_comments"
" WHERE ComCod='%ld'",
sprintf (Query,"DELETE FROM social_comments WHERE ComCod='%ld'",
SocCom->ComCod);
DB_QueryDELETE (Query,"can not remove a social comment");
@ -3572,20 +3585,42 @@ void Soc_RemoveUsrSocialContent (long UsrCod)
{
char Query[512];
/***** Remove favs *****/
/* Remove all favs made by this user in any social note */
sprintf (Query,"DELETE FROM social_notes_fav"
" WHERE UsrCod='%ld'",
/***** Remove favs for comments *****/
/* Remove all favs made by this user in any social comment */
sprintf (Query,"DELETE FROM social_comments_fav WHERE UsrCod='%ld'",
UsrCod);
DB_QueryDELETE (Query,"can not remove favs for social note");
DB_QueryDELETE (Query,"can not remove favs");
/* Remove all favs for all comments of this user */
sprintf (Query,"DELETE FROM social_comments_fav"
" USING social_comments,social_comments_fav"
" WHERE social_comments.UsrCod='%ld'" // Author of the comment
" AND social_comments.ComCod=social_comments_fav.ComCod",
UsrCod);
DB_QueryDELETE (Query,"can not remove favs");
/* Remove all favs for all comments in all the social notes of the user */
sprintf (Query,"DELETE FROM social_comments_fav"
" USING social_notes,social_comments,social_comments_fav"
" WHERE social_notes.UsrCod='%ld'" // Author of the note
" AND social_notes.NotCod=social_comments.NotCod"
" AND social_comments.ComCod=social_comments_fav.ComCod",
UsrCod);
DB_QueryDELETE (Query,"can not remove social comments");
/***** Remove favs for notes *****/
/* Remove all favs made by this user in any social note */
sprintf (Query,"DELETE FROM social_notes_fav WHERE UsrCod='%ld'",
UsrCod);
DB_QueryDELETE (Query,"can not remove favs");
/* Remove all favs for all notes of this user */
sprintf (Query,"DELETE FROM social_notes_fav"
" USING social_notes,social_notes_fav"
" WHERE social_notes.UsrCod='%ld'" // Author
" WHERE social_notes.UsrCod='%ld'" // Author of the note
" AND social_notes.NotCod=social_notes_fav.NotCod",
UsrCod);
DB_QueryDELETE (Query,"can not remove favs for social note");
DB_QueryDELETE (Query,"can not remove favs");
/***** Remove social comments *****/
/* Remove content of all the comments in all the social notes of the user */