Can delete groups.

This commit is contained in:
Pierre HUBERT
2018-08-31 09:56:46 +02:00
parent 9df1c93a24
commit 827fec68c7
5 changed files with 145 additions and 9 deletions

View File

@ -706,6 +706,25 @@ class GroupsController {
return array("success" => "Follow status has been successfully updated!");
}
/**
* Delete a group
*
* @url POST groups/delete
*/
public function delete(){
user_login_required();
//Get the group
$groupID = getPostGroupIdWithAccess("groupID", GroupInfo::ADMIN_ACCESS);
//Delete the group
if(!components()->groups->delete_group($groupID))
Rest_fatal_error(500, "Could not delete group!");
return array("success" => "The group has been successfully deleted!");
}
/**
* Parse a GroupInfo object into an array for the API
*

View File

@ -486,12 +486,6 @@ class PostsController {
if(!CS::get()->components->posts->delete($postID))
Rest_fatal_error(500, "Couldn't delete post!");
//Delete related notifications
$notification = new Notification();
$notification->set_on_elem_type(Notification::POST);
$notification->set_on_elem_id($postID);
components()->notifications->delete($notification);
//Success
return array("success" => "The post has been deleted!");
}