Can delete a group logo

This commit is contained in:
Pierre HUBERT 2018-07-04 14:14:36 +02:00
parent 1b9d9a2f3e
commit feeebcbae3
2 changed files with 23 additions and 2 deletions

View File

@ -171,6 +171,27 @@ class GroupsController {
);
}
/**
* Delete a group logo
*
* @url POST /groups/delete_logo
*/
public function deleteLogo(){
//Get the ID of the group (with admin access)
$groupID = $this->getPostGroupIDWithAdmin("id");
//Try to delete group logo
if(!components()->groups->deleteLogo($groupID))
Rest_fatal_error(500, "An error occurred while trying to delete group logo!");
//Success
return array(
"success" => "The group logo has been successfully deleted!",
"url" => components()->groups->get_settings($groupID)->get_logo_url()
);
}
/**
* Get and return a group ID specified in the POST request
* in which the current user has admin rigths

View File

@ -249,7 +249,7 @@ class GroupsComponent {
return FALSE;
//Save new information
$settings->set_logo("");
$settings->set_logo("null");
return $this->set_settings($settings);
}
@ -274,7 +274,7 @@ class GroupsComponent {
$info->set_number_members($this->countMembers($info->get_id()));
$info->set_membership_level($this->getMembershipLevel(userID, $info->get_id()));
if($data["path_logo"] != null && $data["path_logo"] != "")
if($data["path_logo"] != null && $data["path_logo"] != "" && $data["path_logo"] != "null")
$info->set_logo($data["path_logo"]);
return $info;