mirror of
https://github.com/acanas/swad-core.git
synced 2024-09-22 00:00:40 +02:00
Version 15.107.5
This commit is contained in:
parent
177761bcba
commit
1de926674f
|
@ -117,19 +117,19 @@
|
|||
// 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: Show error message when trying to send a comment in a removed social note
|
||||
// TODO: Check if I can comment a social note
|
||||
|
||||
/*****************************************************************************/
|
||||
/****************************** Public constants *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Log_PLATFORM_VERSION "SWAD 15.107.4 (2016-01-11)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 15.107.5 (2016-01-11)"
|
||||
#define CSS_FILE "swad15.107.2.css"
|
||||
#define JS_FILE "swad15.107.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.107.5: Jan 11, 2016 Check if a user can comment a social note. (192225 lines)
|
||||
Version 15.107.4: Jan 11, 2016 Show separated social note at top when a new comment is added.
|
||||
Message of success when publishing a social note or comment. (192199 lines)
|
||||
Version 15.107.3: Jan 11, 2016 Fixed bug and code refactoring in social comments. (192160 lines)
|
||||
|
|
|
@ -242,6 +242,8 @@ static long Soc_GetParamPubCod (void);
|
|||
static long Soc_GetParamComCod (void);
|
||||
|
||||
static void Soc_ReceiveComment (void);
|
||||
static bool Soc_CheckIfICanCommentNote (long NotCod);
|
||||
|
||||
static void Soc_ShareSocialNote (void);
|
||||
static void Soc_UnshareSocialPublishing (void);
|
||||
static void Soc_UnshareASocialPublishingFromDB (struct SocialNote *SocNot);
|
||||
|
@ -2012,10 +2014,10 @@ static void Soc_ReceiveComment (void)
|
|||
Par_GetParAndChangeFormat ("Comment",Content,Cns_MAX_BYTES_LONG_TEXT,
|
||||
Str_TO_RIGOROUS_HTML,true);
|
||||
|
||||
// TODO: Check if I can comment <=>
|
||||
// <=> if I can view this note <=>
|
||||
// <=> if I am a publisher or if I follow at least one publisher (sharer)
|
||||
if (Content[0])
|
||||
{
|
||||
/***** Check if I can comment *****/
|
||||
if (Soc_CheckIfICanCommentNote (SocNot.NotCod))
|
||||
{
|
||||
/***** Publish *****/
|
||||
/* Insert comment in the database */
|
||||
|
@ -2036,6 +2038,34 @@ static void Soc_ReceiveComment (void)
|
|||
/***** Show the social note just commented *****/
|
||||
Soc_WriteSocialNote (&SocPub,&SocNot,true,false);
|
||||
}
|
||||
else
|
||||
Lay_ShowErrorAndExit ("You can not comment this note.");
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************* Check if I can comment a social note ********************/
|
||||
/*****************************************************************************/
|
||||
// I can comment a social note <=>
|
||||
// <=> if I can view the note <=>
|
||||
// <=> if I am a publisher (author or sharer)
|
||||
// or I follow at least one publisher (author or sharer)
|
||||
|
||||
static bool Soc_CheckIfICanCommentNote (long NotCod)
|
||||
{
|
||||
char Query[256];
|
||||
|
||||
/***** Check if I am a publisher of this note
|
||||
or I follow any of the publishers of this note *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM social_timeline"
|
||||
" WHERE NotCod='%ld' AND PublisherCod IN"
|
||||
" (SELECT '%ld'"
|
||||
" UNION"
|
||||
" SELECT FollowedCod FROM usr_follow WHERE FollowerCod='%ld')",
|
||||
NotCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
return (DB_QueryCOUNT (Query,"can not check if I can comment a social note") != 0);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
Loading…
Reference in New Issue
Block a user