diff --git a/swad_changelog.h b/swad_changelog.h index eba9e69b2..b80df4576 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -120,20 +120,23 @@ // TODO: Change ComCod to PubCod in social_comments and social_comments_fav // TODO: When receiving a new post, create first the publishing, then the post // TODO: Change PstCod to PubCod in social_posts, removing AUTO_INCREMENT +// TODO: View highlighted social note when clicking in timeline notification // TODO: Mark timeline notifications as removed when post/comment are removed or fav/share are undone /*****************************************************************************/ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 15.124.3 (2016-01-24)" +#define Log_PLATFORM_VERSION "SWAD 15.125 (2016-01-24)" #define CSS_FILE "swad15.121.7.css" #define JS_FILE "swad15.121.7.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.124.3: Jan 24, 2016 Mark timeline notifications as seen after viewing social timeline. (? lines) + Version 15.125: Jan 24, 2016 Mark notification about shared social note as removed after unsharing. + 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.2: Jan 23, 2016 Changed numeration of notifications in database. (194546 lines) 14 changes necessary in database: UPDATE notif SET NotifyEvent=17 WHERE NotifyEvent=9; diff --git a/swad_social.c b/swad_social.c index 0302cec7b..e08c88909 100644 --- a/swad_social.c +++ b/swad_social.c @@ -309,9 +309,9 @@ static void Soc_RequestRemovalSocialComment (void); static void Soc_RemoveSocialComment (void); static void Soc_RemoveASocialCommentFromDB (struct SocialComment *SocCom); -static bool Soc_CheckIfNoteIsPublishedInTimelineByUsr (long NotCod,long UsrCod); -static bool Soc_CheckIfNoteIsFavouritedByUsr (long NotCod,long UsrCod); -static bool Soc_CheckIfCommIsFavouritedByUsr (long ComCod,long UsrCod); +static bool Soc_CheckIfNoteIsSharedByUsr (long NotCod,long UsrCod); +static bool Soc_CheckIfNoteIsFavedByUsr (long NotCod,long UsrCod); +static bool Soc_CheckIfCommIsFavedByUsr (long ComCod,long UsrCod); static unsigned Soc_UpdateNumTimesANoteHasBeenShared (struct SocialNote *SocNot); static unsigned Soc_GetNumTimesANoteHasBeenFav (struct SocialNote *SocNot); @@ -1057,8 +1057,8 @@ static void Soc_WriteSocialNote (const struct SocialNote *SocNot, extern const char *Txt_Institution; struct UsrData UsrDat; bool IAmTheAuthor = false; - bool IAmAPublisherOfThisSocNot = false; - bool IAmAFavouriterOfThisSocNot = false; + bool IAmASharerOfThisSocNot = false; + bool IAmAFaverOfThisSocNot = false; struct Institution Ins; struct Centre Ctr; struct Degree Deg; @@ -1114,10 +1114,13 @@ static void Soc_WriteSocialNote (const struct SocialNote *SocNot, if (Gbl.Usrs.Me.Logged) { IAmTheAuthor = (UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod); - IAmAPublisherOfThisSocNot = Soc_CheckIfNoteIsPublishedInTimelineByUsr (SocNot->NotCod, - Gbl.Usrs.Me.UsrDat.UsrCod); - IAmAFavouriterOfThisSocNot = Soc_CheckIfNoteIsFavouritedByUsr (SocNot->NotCod, - Gbl.Usrs.Me.UsrDat.UsrCod); + if (!IAmTheAuthor) + { + IAmASharerOfThisSocNot = Soc_CheckIfNoteIsSharedByUsr (SocNot->NotCod, + Gbl.Usrs.Me.UsrDat.UsrCod); + IAmAFaverOfThisSocNot = Soc_CheckIfNoteIsFavedByUsr (SocNot->NotCod, + Gbl.Usrs.Me.UsrDat.UsrCod); + } } /***** Left: write author's photo *****/ @@ -1271,7 +1274,7 @@ static void Soc_WriteSocialNote (const struct SocialNote *SocNot, /* Put icon to mark this social note as favourite */ if (IAmTheAuthor) // I am the author Soc_PutDisabledIconFav (SocNot->NumFavs); - else if (IAmAFavouriterOfThisSocNot) // I have favourited this social note + else if (IAmAFaverOfThisSocNot) // I have favourited this social note /* Put icon to unfav this publishing */ Soc_PutFormToUnfavSocialNote (SocNot->NotCod); else // I am not the author and I am not a sharer @@ -1289,8 +1292,8 @@ static void Soc_WriteSocialNote (const struct SocialNote *SocNot, /* Put icons to share/unshare */ if (IAmTheAuthor) // I am the author Soc_PutDisabledIconShare (SocNot->NumShared); - else if (IAmAPublisherOfThisSocNot) // I am a sharer of this social note, - // but not the author ==> I have shared this social note + else if (IAmASharerOfThisSocNot) // I am a sharer of this social note, + // but not the author ==> I have shared this social note /* Put icon to unshare this publishing */ Soc_PutFormToUnshareSocialNote (SocNot->NotCod); else // I am not the author and I am not a sharer @@ -2199,7 +2202,7 @@ static void Soc_WriteSocialComment (struct SocialComment *SocCom, extern const char *Txt_Institution; struct UsrData UsrDat; bool IAmTheAuthor; - bool IAmAFavouriterOfThisSocCom; + bool IAmAFaverOfThisSocCom = false; bool ShowPhoto = false; char PhotoURL[PATH_MAX+1]; @@ -2234,8 +2237,9 @@ static void Soc_WriteSocialComment (struct SocialComment *SocCom, Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat); IAmTheAuthor = (Gbl.Usrs.Me.Logged && UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod); - IAmAFavouriterOfThisSocCom = Soc_CheckIfCommIsFavouritedByUsr (SocCom->ComCod, - Gbl.Usrs.Me.UsrDat.UsrCod); + if (!IAmTheAuthor) + IAmAFaverOfThisSocCom = Soc_CheckIfCommIsFavedByUsr (SocCom->ComCod, + Gbl.Usrs.Me.UsrDat.UsrCod); /***** Left: write author's photo *****/ fprintf (Gbl.F.Out,"