Can get and return following state of a user.

This commit is contained in:
Pierre HUBERT
2018-07-17 10:56:12 +02:00
parent 46730f2b97
commit f054107277
4 changed files with 46 additions and 3 deletions

View File

@ -116,11 +116,17 @@ class GroupsController {
if(!$group->isValid())
Rest_fatal_error(404, "The requested group was not found !");
//If the user is signed in, check whether he is liking or not the group
if(userID > 0)
//If the user is signed in, check whether he is liking and following or not the group
if(userID > 0) {
$group->setLiking(components()->likes->is_liking(
userID, $group->get_id(), Likes::LIKE_GROUP));
$group->set_following(components()->groups->isFollowing(
userID, $group->get_id()
));
}
//Parse and return information about the group
return self::AdvancedGroupInfoToAPI($group);
}
@ -638,6 +644,7 @@ class GroupsController {
$data["registration_level"] = self::GROUPS_REGISTRATION_LEVELS[$info->get_registration_level()];
$data["posts_level"] = self::GROUPS_POSTS_LEVELS[$info->get_posts_level()];
$data["virtual_directory"] = $info->get_virtual_directory();
$data["following"] = $info->isFollowing();
return $data;
}