mirror of
https://github.com/acanas/swad-core.git
synced 2024-06-29 20:05:45 +02:00
Version 15.125.1
This commit is contained in:
parent
fc51cdb747
commit
047733a3aa
|
@ -127,15 +127,15 @@
|
||||||
/****************************** Public constants *****************************/
|
/****************************** Public constants *****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define Log_PLATFORM_VERSION "SWAD 15.125 (2016-01-24)"
|
#define Log_PLATFORM_VERSION "SWAD 15.125.1 (2016-01-24)"
|
||||||
#define CSS_FILE "swad15.121.7.css"
|
#define CSS_FILE "swad15.121.7.css"
|
||||||
#define JS_FILE "swad15.121.7.js"
|
#define JS_FILE "swad15.121.7.js"
|
||||||
|
|
||||||
// Number of lines (includes comments but not blank lines) has been got with the following command:
|
// 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
|
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h sql/swad*.sql | tail -1
|
||||||
/*
|
/*
|
||||||
Version 15.125: Jan 24, 2016 Mark notification about shared social note as removed after unsharing.
|
Version 15.125.1: Jan 24, 2016 Mark notifications as removed after removing a social note. (194603 lines)
|
||||||
Code refactoring in social timeline. (194563 lines)
|
Version 15.125: Jan 24, 2016 Code refactoring in social timeline. (194563 lines)
|
||||||
Version 15.124.3: Jan 24, 2016 Mark timeline notifications as seen after viewing social timeline. (194554 lines)
|
Version 15.124.3: Jan 24, 2016 Mark timeline notifications as seen after viewing social timeline. (194554 lines)
|
||||||
Version 15.124.2: Jan 23, 2016 Changed numeration of notifications in database. (194546 lines)
|
Version 15.124.2: Jan 23, 2016 Changed numeration of notifications in database. (194546 lines)
|
||||||
14 changes necessary in database:
|
14 changes necessary in database:
|
||||||
|
|
113
swad_social.c
113
swad_social.c
|
@ -304,6 +304,7 @@ static long Soc_UnfavSocialComment (void);
|
||||||
static void Soc_RequestRemovalSocialNote (void);
|
static void Soc_RequestRemovalSocialNote (void);
|
||||||
static void Soc_RemoveSocialNote (void);
|
static void Soc_RemoveSocialNote (void);
|
||||||
static void Soc_RemoveASocialNoteFromDB (struct SocialNote *SocNot);
|
static void Soc_RemoveASocialNoteFromDB (struct SocialNote *SocNot);
|
||||||
|
static long Soc_GetPubCodOfOriginalSocialNote (long NotCod);
|
||||||
|
|
||||||
static void Soc_RequestRemovalSocialComment (void);
|
static void Soc_RequestRemovalSocialComment (void);
|
||||||
static void Soc_RemoveSocialComment (void);
|
static void Soc_RemoveSocialComment (void);
|
||||||
|
@ -3077,10 +3078,7 @@ static long Soc_UnshareSocialNote (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_The_original_post_no_longer_exists;
|
extern const char *Txt_The_original_post_no_longer_exists;
|
||||||
char Query[256];
|
char Query[256];
|
||||||
MYSQL_RES *mysql_res;
|
|
||||||
MYSQL_ROW row;
|
|
||||||
struct SocialNote SocNot;
|
struct SocialNote SocNot;
|
||||||
long PubCod;
|
|
||||||
|
|
||||||
/***** Get data of social note *****/
|
/***** Get data of social note *****/
|
||||||
SocNot.NotCod = Soc_GetParamNotCod ();
|
SocNot.NotCod = Soc_GetParamNotCod ();
|
||||||
|
@ -3094,36 +3092,15 @@ static long Soc_UnshareSocialNote (void)
|
||||||
if (Soc_CheckIfNoteIsSharedByUsr (SocNot.NotCod,
|
if (Soc_CheckIfNoteIsSharedByUsr (SocNot.NotCod,
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod)) // I am a sharer
|
Gbl.Usrs.Me.UsrDat.UsrCod)) // I am a sharer
|
||||||
{
|
{
|
||||||
/***** Get code of social publishing from database *****/
|
/***** Delete social publishing from database *****/
|
||||||
sprintf (Query,"SELECT PubCod FROM social_pubs"
|
sprintf (Query,"DELETE FROM social_pubs"
|
||||||
" WHERE NotCod='%ld'"
|
" WHERE NotCod='%ld'"
|
||||||
" AND PublisherCod='%ld'" // I have share this note
|
" AND Publisher='%ld'"
|
||||||
" AND PubType='%u'", // It's a shared note
|
" AND PubType='%u'",
|
||||||
SocNot.NotCod,
|
SocNot.NotCod,
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
(unsigned) Soc_PUB_SHARED_NOTE);
|
(unsigned) Soc_PUB_SHARED_NOTE);
|
||||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get code of social publishing") == 1) // Result should have a unique row
|
DB_QueryDELETE (Query,"can not remove a social publishing");
|
||||||
{
|
|
||||||
/* Get code of social publishing (row[0]) */
|
|
||||||
row = mysql_fetch_row (mysql_res);
|
|
||||||
PubCod = Str_ConvertStrCodToLongCod (row[0]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
PubCod = -1L;
|
|
||||||
|
|
||||||
/* Free structure that stores the query result */
|
|
||||||
DB_FreeMySQLResult (&mysql_res);
|
|
||||||
|
|
||||||
if (PubCod > 0)
|
|
||||||
{
|
|
||||||
/***** Delete social publishing from database *****/
|
|
||||||
sprintf (Query,"DELETE FROM social_pubs WHERE PubCod='%ld'",
|
|
||||||
PubCod);
|
|
||||||
DB_QueryDELETE (Query,"can not remove a social publishing");
|
|
||||||
|
|
||||||
/***** Mark possible notification as removed *****/
|
|
||||||
Ntf_MarkNotifAsRemoved (Ntf_EVENT_TIMELINE_SHARE,PubCod);
|
|
||||||
}
|
|
||||||
|
|
||||||
/***** Update number of times this social note is shared *****/
|
/***** Update number of times this social note is shared *****/
|
||||||
SocNot.NumShared = Soc_UpdateNumTimesANoteHasBeenShared (&SocNot);
|
SocNot.NumShared = Soc_UpdateNumTimesANoteHasBeenShared (&SocNot);
|
||||||
|
@ -3442,7 +3419,52 @@ static void Soc_RemoveSocialNote (void)
|
||||||
|
|
||||||
static void Soc_RemoveASocialNoteFromDB (struct SocialNote *SocNot)
|
static void Soc_RemoveASocialNoteFromDB (struct SocialNote *SocNot)
|
||||||
{
|
{
|
||||||
char Query[256];
|
char Query[128];
|
||||||
|
MYSQL_RES *mysql_res;
|
||||||
|
MYSQL_ROW row;
|
||||||
|
long PubCod;
|
||||||
|
unsigned long NumComments;
|
||||||
|
unsigned long NumCom;
|
||||||
|
|
||||||
|
/***** Mark possible notifications on this social note as removed *****/
|
||||||
|
PubCod = Soc_GetPubCodOfOriginalSocialNote (SocNot->NotCod);
|
||||||
|
if (PubCod > 0)
|
||||||
|
{
|
||||||
|
Ntf_MarkNotifAsRemoved (Ntf_EVENT_TIMELINE_PUBLISH,PubCod);
|
||||||
|
Ntf_MarkNotifAsRemoved (Ntf_EVENT_TIMELINE_FAV ,PubCod);
|
||||||
|
Ntf_MarkNotifAsRemoved (Ntf_EVENT_TIMELINE_SHARE ,PubCod);
|
||||||
|
Ntf_MarkNotifAsRemoved (Ntf_EVENT_TIMELINE_MENTION,PubCod);
|
||||||
|
}
|
||||||
|
|
||||||
|
/***** Mark possible notifications on the comments
|
||||||
|
of this social note as removed *****/
|
||||||
|
/* Get comments of this social note */
|
||||||
|
sprintf (Query,"SELECT PubCod FROM social_pubs"
|
||||||
|
" WHERE NotCod='%ld' AND PubType='%u'",
|
||||||
|
SocNot->NotCod,(unsigned) Soc_PUB_COMMENT_TO_NOTE);
|
||||||
|
NumComments = DB_QuerySELECT (Query,&mysql_res,"can not get social comments");
|
||||||
|
|
||||||
|
/* For each comment... */
|
||||||
|
for (NumCom = 0;
|
||||||
|
NumCom < NumComments;
|
||||||
|
NumCom++)
|
||||||
|
{
|
||||||
|
/* Get code of social comment **/
|
||||||
|
row = mysql_fetch_row (mysql_res);
|
||||||
|
PubCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||||
|
|
||||||
|
/* Mark notifications as removed */
|
||||||
|
if (PubCod > 0)
|
||||||
|
{
|
||||||
|
Ntf_MarkNotifAsRemoved (Ntf_EVENT_TIMELINE_PUBLISH,PubCod);
|
||||||
|
Ntf_MarkNotifAsRemoved (Ntf_EVENT_TIMELINE_COMMENT,PubCod);
|
||||||
|
Ntf_MarkNotifAsRemoved (Ntf_EVENT_TIMELINE_FAV ,PubCod);
|
||||||
|
Ntf_MarkNotifAsRemoved (Ntf_EVENT_TIMELINE_MENTION,PubCod);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Free structure that stores the query result */
|
||||||
|
DB_FreeMySQLResult (&mysql_res);
|
||||||
|
|
||||||
/***** Remove favs *****/
|
/***** Remove favs *****/
|
||||||
/* Remove favs for all comments in this note */
|
/* Remove favs for all comments in this note */
|
||||||
|
@ -3494,6 +3516,29 @@ static void Soc_RemoveASocialNoteFromDB (struct SocialNote *SocNot)
|
||||||
Soc_ResetSocialNote (SocNot);
|
Soc_ResetSocialNote (SocNot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/************ Get code of social publishing of the original note *************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
static long Soc_GetPubCodOfOriginalSocialNote (long NotCod)
|
||||||
|
{
|
||||||
|
char Query[256];
|
||||||
|
MYSQL_RES *mysql_res;
|
||||||
|
MYSQL_ROW row;
|
||||||
|
|
||||||
|
/***** Get code of social publishing of the original note *****/
|
||||||
|
sprintf (Query,"SELECT PubCod FROM social_pubs"
|
||||||
|
" WHERE NotCod='%ld' AND PubType='%u'",
|
||||||
|
NotCod,(unsigned) Soc_PUB_ORIGINAL_NOTE);
|
||||||
|
if (DB_QuerySELECT (Query,&mysql_res,"can not get code of social publishing") == 1) // Result should have a unique row
|
||||||
|
{
|
||||||
|
/* Get code of social publishing (row[0]) */
|
||||||
|
row = mysql_fetch_row (mysql_res);
|
||||||
|
return Str_ConvertStrCodToLongCod (row[0]);
|
||||||
|
}
|
||||||
|
return -1L;
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/************* Request the removal of a comment in a social note *************/
|
/************* Request the removal of a comment in a social note *************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
Loading…
Reference in New Issue
Block a user