mirror of
https://github.com/acanas/swad-core.git
synced 2024-06-02 14:55:23 +02:00
Version 15.108
This commit is contained in:
parent
53d82b6f56
commit
86d0acb3a3
|
@ -969,7 +969,6 @@ CREATE TABLE IF NOT EXISTS social_timeline (
|
||||||
UNIQUE INDEX(PubCod),
|
UNIQUE INDEX(PubCod),
|
||||||
UNIQUE INDEX(NotCod,PublisherCod),
|
UNIQUE INDEX(NotCod,PublisherCod),
|
||||||
INDEX(PublisherCod),
|
INDEX(PublisherCod),
|
||||||
INDEX(AuthorCod),
|
|
||||||
INDEX(TimePublish));
|
INDEX(TimePublish));
|
||||||
--
|
--
|
||||||
-- Table sta_degrees: stores statistics about degrees
|
-- Table sta_degrees: stores statistics about degrees
|
||||||
|
|
|
@ -117,18 +117,24 @@
|
||||||
// TODO: Increment one second after each refresh in social timeline?
|
// TODO: Increment one second after each refresh in social timeline?
|
||||||
// TODO: Include time of last comment in table social_timeline to display social publishings with new comments when refreshing
|
// TODO: Include time of last comment in table social_timeline to display social publishings with new comments when refreshing
|
||||||
// TODO: Add a new type of visibility of profile "unknown". Keep the same for photos?
|
// TODO: Add a new type of visibility of profile "unknown". Keep the same for photos?
|
||||||
|
// TODO: Sinchronize timeline in other actions
|
||||||
|
// TODO: Fix bug: I just unshare a note. If I comment the separated note just unshared, a warning Txt_The_original_post_no_longer_exists is reported.
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/****************************** Public constants *****************************/
|
/****************************** Public constants *****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define Log_PLATFORM_VERSION "SWAD 15.107.7 (2016-01-11)"
|
#define Log_PLATFORM_VERSION "SWAD 15.108 (2016-01-11)"
|
||||||
#define CSS_FILE "swad15.107.2.css"
|
#define CSS_FILE "swad15.107.2.css"
|
||||||
#define JS_FILE "swad15.107.2.js"
|
#define JS_FILE "swad15.107.2.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.108: Jan 11, 2016 Field with the author of a social note is removed from table with timeline, because it can be obtained from table with social notes. (192289 lines)
|
||||||
|
1 change necessary in database:
|
||||||
|
ALTER TABLE social_timeline DROP COLUMN AuthorCod;
|
||||||
|
|
||||||
Version 15.107.7: Jan 11, 2016 Show error message when trying to share a removed social note. (192284 lines)
|
Version 15.107.7: Jan 11, 2016 Show error message when trying to share a removed social note. (192284 lines)
|
||||||
Version 15.107.6: Jan 11, 2016 Show error message when trying to send a comment in a removed social note. (192276 lines)
|
Version 15.107.6: Jan 11, 2016 Show error message when trying to send a comment in a removed social note. (192276 lines)
|
||||||
Version 15.107.5: Jan 11, 2016 Check if a user can comment a social note. (192225 lines)
|
Version 15.107.5: Jan 11, 2016 Check if a user can comment a social note. (192225 lines)
|
||||||
|
|
|
@ -2035,21 +2035,18 @@ mysql> DESCRIBE social_timeline;
|
||||||
| PubCod | bigint(20) | NO | PRI | NULL | auto_increment |
|
| PubCod | bigint(20) | NO | PRI | NULL | auto_increment |
|
||||||
| NotCod | bigint(20) | NO | MUL | NULL | |
|
| NotCod | bigint(20) | NO | MUL | NULL | |
|
||||||
| PublisherCod | int(11) | NO | MUL | NULL | |
|
| PublisherCod | int(11) | NO | MUL | NULL | |
|
||||||
| AuthorCod | int(11) | NO | MUL | NULL | |
|
|
||||||
| TimePublish | datetime | NO | MUL | NULL | |
|
| TimePublish | datetime | NO | MUL | NULL | |
|
||||||
+--------------+------------+------+-----+---------+----------------+
|
+--------------+------------+------+-----+---------+----------------+
|
||||||
5 rows in set (0.00 sec)
|
4 rows in set (0.01 sec)
|
||||||
*/
|
*/
|
||||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS social_timeline ("
|
DB_CreateTable ("CREATE TABLE IF NOT EXISTS social_timeline ("
|
||||||
"PubCod BIGINT NOT NULL AUTO_INCREMENT,"
|
"PubCod BIGINT NOT NULL AUTO_INCREMENT,"
|
||||||
"NotCod BIGINT NOT NULL,"
|
"NotCod BIGINT NOT NULL,"
|
||||||
"PublisherCod INT NOT NULL,"
|
"PublisherCod INT NOT NULL,"
|
||||||
"AuthorCod INT NOT NULL,"
|
|
||||||
"TimePublish DATETIME NOT NULL,"
|
"TimePublish DATETIME NOT NULL,"
|
||||||
"UNIQUE INDEX(PubCod),"
|
"UNIQUE INDEX(PubCod),"
|
||||||
"UNIQUE INDEX(NotCod,PublisherCod),"
|
"UNIQUE INDEX(NotCod,PublisherCod),"
|
||||||
"INDEX(PublisherCod),"
|
"INDEX(PublisherCod),"
|
||||||
"INDEX(AuthorCod),"
|
|
||||||
"INDEX(TimePublish))");
|
"INDEX(TimePublish))");
|
||||||
|
|
||||||
/***** Table sta_degrees *****/
|
/***** Table sta_degrees *****/
|
||||||
|
|
|
@ -151,8 +151,8 @@ struct SocialPublishing
|
||||||
{
|
{
|
||||||
long PubCod;
|
long PubCod;
|
||||||
long NotCod;
|
long NotCod;
|
||||||
long PublisherCod;
|
long PublisherCod; // Sharer or writer of a comment
|
||||||
long AuthorCod;
|
Soc_PubType_t PubType;
|
||||||
time_t DateTimeUTC;
|
time_t DateTimeUTC;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -283,7 +283,7 @@ void Soc_ShowTimelineUsr (void)
|
||||||
char Query[512];
|
char Query[512];
|
||||||
|
|
||||||
/***** Build query to show timeline with publishing of a unique user *****/
|
/***** Build query to show timeline with publishing of a unique user *****/
|
||||||
sprintf (Query,"SELECT PubCod,NotCod,PublisherCod,AuthorCod,UNIX_TIMESTAMP(TimePublish)"
|
sprintf (Query,"SELECT PubCod,NotCod,PublisherCod,UNIX_TIMESTAMP(TimePublish)"
|
||||||
" FROM social_timeline"
|
" FROM social_timeline"
|
||||||
" WHERE PublisherCod='%ld'"
|
" WHERE PublisherCod='%ld'"
|
||||||
" ORDER BY PubCod DESC LIMIT %u",
|
" ORDER BY PubCod DESC LIMIT %u",
|
||||||
|
@ -422,7 +422,7 @@ static void Soc_BuildQueryToGetTimelineGbl (Soc_WhatToGetFromTimeline_t WhatToGe
|
||||||
Soc_UpdateLastPubCodIntoSession ();
|
Soc_UpdateLastPubCodIntoSession ();
|
||||||
|
|
||||||
/***** Build query to show timeline including the users I am following *****/
|
/***** Build query to show timeline including the users I am following *****/
|
||||||
sprintf (Query,"SELECT PubCod,NotCod,PublisherCod,AuthorCod,UNIX_TIMESTAMP(TimePublish)"
|
sprintf (Query,"SELECT PubCod,NotCod,PublisherCod,UNIX_TIMESTAMP(TimePublish)"
|
||||||
" FROM social_timeline WHERE PubCod IN "
|
" FROM social_timeline WHERE PubCod IN "
|
||||||
"(SELECT PubCod FROM pub_cods)"
|
"(SELECT PubCod FROM pub_cods)"
|
||||||
" ORDER BY PubCod DESC");
|
" ORDER BY PubCod DESC");
|
||||||
|
@ -742,12 +742,11 @@ static void Soc_WriteSocialNote (const struct SocialPublishing *SocPub,
|
||||||
fprintf (Gbl.F.Out," class=\"SOCIAL_PUB\"");
|
fprintf (Gbl.F.Out," class=\"SOCIAL_PUB\"");
|
||||||
fprintf (Gbl.F.Out,">");
|
fprintf (Gbl.F.Out,">");
|
||||||
|
|
||||||
if (SocPub->PubCod <= 0 ||
|
if (SocPub->PubCod <= 0 ||
|
||||||
SocPub->NotCod <= 0 ||
|
SocPub->NotCod <= 0 ||
|
||||||
SocPub->PublisherCod <= 0 ||
|
SocPub->PublisherCod <= 0 ||
|
||||||
SocPub->AuthorCod <= 0 ||
|
SocNot->NoteType == Soc_NOTE_UNKNOWN ||
|
||||||
SocNot->NoteType == Soc_NOTE_UNKNOWN ||
|
SocNot->UsrCod <= 0)
|
||||||
SocNot->UsrCod <= 0)
|
|
||||||
Lay_ShowAlert (Lay_ERROR,"Error in social note.");
|
Lay_ShowAlert (Lay_ERROR,"Error in social note.");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1196,7 +1195,6 @@ void Soc_StoreAndPublishSocialNote (Soc_NoteType_t NoteType,long Cod)
|
||||||
SocPub.NotCod = DB_QueryINSERTandReturnCode (Query,"can not create new social note");
|
SocPub.NotCod = DB_QueryINSERTandReturnCode (Query,"can not create new social note");
|
||||||
|
|
||||||
/***** Publish social note in timeline *****/
|
/***** Publish social note in timeline *****/
|
||||||
SocPub.AuthorCod =
|
|
||||||
SocPub.PublisherCod = Gbl.Usrs.Me.UsrDat.UsrCod;
|
SocPub.PublisherCod = Gbl.Usrs.Me.UsrDat.UsrCod;
|
||||||
Soc_PublishSocialNoteInTimeline (&SocPub);
|
Soc_PublishSocialNoteInTimeline (&SocPub);
|
||||||
}
|
}
|
||||||
|
@ -1368,10 +1366,10 @@ static void Soc_PublishSocialNoteInTimeline (struct SocialPublishing *SocPub)
|
||||||
|
|
||||||
/***** Publish social note in timeline *****/
|
/***** Publish social note in timeline *****/
|
||||||
sprintf (Query,"INSERT INTO social_timeline"
|
sprintf (Query,"INSERT INTO social_timeline"
|
||||||
" (NotCod,PublisherCod,AuthorCod,TimePublish)"
|
" (NotCod,PublisherCod,TimePublish)"
|
||||||
" VALUES"
|
" VALUES"
|
||||||
" ('%ld','%ld','%ld',NOW())",
|
" ('%ld','%ld',NOW())",
|
||||||
SocPub->NotCod,SocPub->PublisherCod,SocPub->AuthorCod);
|
SocPub->NotCod,SocPub->PublisherCod);
|
||||||
SocPub->PubCod = DB_QueryINSERTandReturnCode (Query,"can not publish social note");
|
SocPub->PubCod = DB_QueryINSERTandReturnCode (Query,"can not publish social note");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2142,7 +2140,6 @@ static void Soc_ShareSocialNote (void)
|
||||||
if (ICanShare)
|
if (ICanShare)
|
||||||
{
|
{
|
||||||
/***** Share (publish social note in timeline) *****/
|
/***** Share (publish social note in timeline) *****/
|
||||||
SocPub.AuthorCod = SocNot.UsrCod;
|
|
||||||
SocPub.PublisherCod = Gbl.Usrs.Me.UsrDat.UsrCod;
|
SocPub.PublisherCod = Gbl.Usrs.Me.UsrDat.UsrCod;
|
||||||
SocPub.NotCod = SocNot.NotCod;
|
SocPub.NotCod = SocNot.NotCod;
|
||||||
Soc_PublishSocialNoteInTimeline (&SocPub); // Set SocPub.PubCod
|
Soc_PublishSocialNoteInTimeline (&SocPub); // Set SocPub.PubCod
|
||||||
|
@ -2244,13 +2241,15 @@ static void Soc_UnshareSocialPublishing (void)
|
||||||
|
|
||||||
static void Soc_UnshareASocialPublishingFromDB (struct SocialNote *SocNot)
|
static void Soc_UnshareASocialPublishingFromDB (struct SocialNote *SocNot)
|
||||||
{
|
{
|
||||||
char Query[128];
|
char Query[256];
|
||||||
|
|
||||||
/***** Remove social publishing *****/
|
/***** Remove social publishing *****/
|
||||||
sprintf (Query,"DELETE FROM social_timeline"
|
sprintf (Query,"DELETE FROM social_timeline"
|
||||||
" WHERE NotCod='%ld'"
|
" USING social_timeline,social_notes"
|
||||||
" AND PublisherCod='%ld'" // I have share this note
|
" WHERE social_timeline.NotCod='%ld'"
|
||||||
" AND AuthorCod<>'%ld'", // I am not the author
|
" AND social_timeline.PublisherCod='%ld'" // I have share this note
|
||||||
|
" AND social_timeline.NotCod=social_notes.NotCod"
|
||||||
|
" AND social_notes.UsrCod<>'%ld'", // I am not the author
|
||||||
SocNot->NotCod,
|
SocNot->NotCod,
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
|
@ -2308,9 +2307,8 @@ static void Soc_RequestRemovalSocialNote (void)
|
||||||
Soc_GetDataOfSocialNoteByCod (&SocNot);
|
Soc_GetDataOfSocialNoteByCod (&SocNot);
|
||||||
|
|
||||||
ICanRemove = (Gbl.Usrs.Me.Logged &&
|
ICanRemove = (Gbl.Usrs.Me.Logged &&
|
||||||
SocPub.PublisherCod == Gbl.Usrs.Me.UsrDat.UsrCod &&
|
SocPub.PublisherCod == Gbl.Usrs.Me.UsrDat.UsrCod && // I have published this note
|
||||||
SocPub.AuthorCod == Gbl.Usrs.Me.UsrDat.UsrCod &&
|
SocNot.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod); // I am the author of this note
|
||||||
SocNot.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
|
||||||
if (ICanRemove)
|
if (ICanRemove)
|
||||||
{
|
{
|
||||||
if (Soc_CheckIfNoteIsPublishedInTimelineByUsr (SocNot.NotCod,SocNot.UsrCod))
|
if (Soc_CheckIfNoteIsPublishedInTimelineByUsr (SocNot.NotCod,SocNot.UsrCod))
|
||||||
|
@ -2390,9 +2388,8 @@ static void Soc_RemoveSocialNote (void)
|
||||||
Soc_GetDataOfSocialNoteByCod (&SocNot);
|
Soc_GetDataOfSocialNoteByCod (&SocNot);
|
||||||
|
|
||||||
ICanRemove = (Gbl.Usrs.Me.Logged &&
|
ICanRemove = (Gbl.Usrs.Me.Logged &&
|
||||||
SocPub.PublisherCod == Gbl.Usrs.Me.UsrDat.UsrCod &&
|
SocPub.PublisherCod == Gbl.Usrs.Me.UsrDat.UsrCod && // I have published this note
|
||||||
SocPub.AuthorCod == Gbl.Usrs.Me.UsrDat.UsrCod &&
|
SocNot.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod); // I am the author of this note
|
||||||
SocNot.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
|
|
||||||
if (ICanRemove)
|
if (ICanRemove)
|
||||||
{
|
{
|
||||||
/***** Delete social publishing from database *****/
|
/***** Delete social publishing from database *****/
|
||||||
|
@ -2412,11 +2409,8 @@ static void Soc_RemoveASocialNoteFromDB (struct SocialNote *SocNot)
|
||||||
char Query[256];
|
char Query[256];
|
||||||
|
|
||||||
/***** Remove all the social publishings of this note *****/
|
/***** Remove all the social publishings of this note *****/
|
||||||
sprintf (Query,"DELETE FROM social_timeline"
|
sprintf (Query,"DELETE FROM social_timeline WHERE NotCod='%ld'",
|
||||||
" WHERE NotCod='%ld'"
|
SocNot->NotCod);
|
||||||
" AND AuthorCod='%ld'", // Extra check: I am the author
|
|
||||||
SocNot->NotCod,
|
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
|
||||||
DB_QueryDELETE (Query,"can not remove a social publishing");
|
DB_QueryDELETE (Query,"can not remove a social publishing");
|
||||||
|
|
||||||
/***** Remove social note *****/
|
/***** Remove social note *****/
|
||||||
|
@ -2619,7 +2613,7 @@ static void Soc_RemoveASocialCommentFromDB (struct SocialComment *SocCom)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/******************* Remove a social note from database **********************/
|
/********** Remove all the social content of a user from database ************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void Soc_RemoveUsrSocialContent (long UsrCod)
|
void Soc_RemoveUsrSocialContent (long UsrCod)
|
||||||
|
@ -2667,8 +2661,16 @@ void Soc_RemoveUsrSocialContent (long UsrCod)
|
||||||
|
|
||||||
/***** Remove all the social publishings of the user *****/
|
/***** Remove all the social publishings of the user *****/
|
||||||
sprintf (Query,"DELETE FROM social_timeline"
|
sprintf (Query,"DELETE FROM social_timeline"
|
||||||
" WHERE AuthorCod='%ld' OR PublisherCod='%ld'",
|
" WHERE PublisherCod='%ld'",
|
||||||
UsrCod,UsrCod);
|
UsrCod);
|
||||||
|
DB_QueryDELETE (Query,"can not remove social publishings");
|
||||||
|
|
||||||
|
/***** Remove all the social publishings authored by the user *****/
|
||||||
|
sprintf (Query,"DELETE FROM social_timeline"
|
||||||
|
" USING social_notes,social_timeline"
|
||||||
|
" WHERE social_notes.UsrCod='%ld'"
|
||||||
|
" AND social_notes.NotCod=social_timeline.NotCod",
|
||||||
|
UsrCod);
|
||||||
DB_QueryDELETE (Query,"can not remove social publishings");
|
DB_QueryDELETE (Query,"can not remove social publishings");
|
||||||
|
|
||||||
/***** Remove all the social notes of the user *****/
|
/***** Remove all the social notes of the user *****/
|
||||||
|
@ -2797,7 +2799,7 @@ static void Soc_GetDataOfSocialPublishingByCod (struct SocialPublishing *SocPub)
|
||||||
if (SocPub->PubCod > 0)
|
if (SocPub->PubCod > 0)
|
||||||
{
|
{
|
||||||
/***** Get data of social publishing from database *****/
|
/***** Get data of social publishing from database *****/
|
||||||
sprintf (Query,"SELECT PubCod,NotCod,PublisherCod,AuthorCod,UNIX_TIMESTAMP(TimePublish)"
|
sprintf (Query,"SELECT PubCod,NotCod,PublisherCod,UNIX_TIMESTAMP(TimePublish)"
|
||||||
" FROM social_timeline"
|
" FROM social_timeline"
|
||||||
" WHERE PubCod='%ld'",
|
" WHERE PubCod='%ld'",
|
||||||
SocPub->PubCod);
|
SocPub->PubCod);
|
||||||
|
@ -2902,11 +2904,8 @@ static void Soc_GetDataOfSocialPublishingFromRow (MYSQL_ROW row,struct SocialPub
|
||||||
/* Get publisher's code (row[2]) */
|
/* Get publisher's code (row[2]) */
|
||||||
SocPub->PublisherCod = Str_ConvertStrCodToLongCod (row[2]);
|
SocPub->PublisherCod = Str_ConvertStrCodToLongCod (row[2]);
|
||||||
|
|
||||||
/* Get author's code (row[3]) */
|
/* Get time of the note (row[3]) */
|
||||||
SocPub->AuthorCod = Str_ConvertStrCodToLongCod (row[3]);
|
SocPub->DateTimeUTC = Dat_GetUNIXTimeFromStr (row[3]);
|
||||||
|
|
||||||
/* Get time of the note (row[4]) */
|
|
||||||
SocPub->DateTimeUTC = Dat_GetUNIXTimeFromStr (row[4]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -2984,7 +2983,6 @@ static void Soc_ResetSocialPublishing (struct SocialPublishing *SocPub)
|
||||||
SocPub->PubCod = -1L;
|
SocPub->PubCod = -1L;
|
||||||
SocPub->NotCod = -1L;
|
SocPub->NotCod = -1L;
|
||||||
SocPub->PublisherCod = -1L;
|
SocPub->PublisherCod = -1L;
|
||||||
SocPub->AuthorCod = -1L;
|
|
||||||
SocPub->DateTimeUTC = (time_t) 0;
|
SocPub->DateTimeUTC = (time_t) 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,13 @@
|
||||||
/******************************** Public types *******************************/
|
/******************************** Public types *******************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
Soc_ORIGINAL_NOTE,
|
||||||
|
Soc_SHARED_NOTE,
|
||||||
|
Soc_COMMENT_TO_NOTE,
|
||||||
|
} Soc_PubType_t;
|
||||||
|
|
||||||
#define Soc_NUM_SOCIAL_NOTES 13
|
#define Soc_NUM_SOCIAL_NOTES 13
|
||||||
// If the numbers assigned to each event type change,
|
// If the numbers assigned to each event type change,
|
||||||
// it is necessary to change old numbers to new ones in database table social_notes
|
// it is necessary to change old numbers to new ones in database table social_notes
|
||||||
|
|
Loading…
Reference in New Issue
Block a user