mirror of
				https://github.com/pierre42100/ComunicWeb
				synced 2025-11-03 19:54:14 +00:00 
			
		
		
		
	Added follow block.
This commit is contained in:
		@@ -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);
 | 
			
		||||
	}
 | 
			
		||||
};
 | 
			
		||||
@@ -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
 | 
			
		||||
	 * 
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user