Added follow block.

This commit is contained in:
Pierre HUBERT
2018-07-19 14:34:19 +02:00
parent a5815272c8
commit 61a20e8708
6 changed files with 106 additions and 0 deletions

View File

@ -306,4 +306,21 @@ ComunicWeb.components.groups.interface = {
};
ComunicWeb.common.api.makeAPIrequest(apiURI, params, true, callback);
},
/**
* Set whether a user is following a group or not
*
* @param {Number} groupID The ID of the target group
* @param {Boolean} follow
* @param {Function} callback
*/
setFollowing: function(groupID, follow, callback){
//Perform the request over the API
var apiURI = "groups/set_following";
var params = {
groupID: groupID,
follow: follow
};
ComunicWeb.common.api.makeAPIrequest(apiURI, params, true, callback);
}
};

View File

@ -25,6 +25,19 @@ ComunicWeb.components.groups.utils = {
},
/**
* Check whether a user is a member (or more) of a group or not
*
* @param {Object} info Information about the target group
* @return {boolean} TRUE if the user is a member of the group
* FALSE else
*/
isGroupMember: function(info){
return info.membership == "member"
|| info.membership == "moderator"
|| info.membership == "administrator";
},
/**
* Check whether a user can create posts for a group or not
*