Can update following status of a group membership.

This commit is contained in:
Pierre HUBERT
2018-07-19 14:43:29 +02:00
parent f054107277
commit 6c100fecce
2 changed files with 38 additions and 0 deletions

View File

@ -626,6 +626,28 @@ class GroupsController {
return array("success" => "Your membership has been successfully deleted!");
}
/**
* Set whether a user is following a group or not
*
* @url POST groups/set_following
*/
public function setFollowing(){
user_login_required();
//Get the group
$groupID = getPostGroupIdWithAccess("groupID", GroupInfo::MEMBER_ACCESS);
//Get following status
$following = postBool("follow");
//Save the new value
if(!components()->groups->setFollowing($groupID, userID, $following))
Rest_fatal_error(500, "Could not update following status!");
//Success
return array("success" => "Follow status has been successfully updated!");
}
/**
* Parse a GroupInfo object into an array for the API
*