Skip to content
Snippets Groups Projects
Commit 1b7e0523 authored by Timo Furrer's avatar Timo Furrer :juggling:
Browse files

Merge branch 'feature/group-avatar-removal-api' into 'master'

Support Group Avatar Removal in REST API

See merge request !96421



Merged-by: default avatarTimo Furrer <tuxtimo@gmail.com>
Approved-by: default avatarMarcin Sedlak-Jakubowski <msedlakjakubowski@gitlab.com>
Approved-by: default avatarCarla Drago <cdrago@gitlab.com>
Approved-by: Allen Cook's avatarAllen Cook <acook@gitlab.com>
parents e1fc1eaf b212c782
No related branches found
No related tags found
No related merge requests found
Pipeline #642411489 passed
......@@ -1113,6 +1113,19 @@ curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab
--form "avatar=@/tmp/example.png"
```
### Remove a group avatar
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/96421) in GitLab 15.4.
To remove a group avatar, use a blank value for the `avatar` attribute.
Example request:
```shell
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/22" \
--data "avatar="
```
## Remove group
> - Immediately deleting subgroups was [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/360008) in GitLab 15.3 [with a flag](../administration/feature_flags.md) named `immediate_delete_subgroup_api`. Disabled by default.
......
......@@ -248,6 +248,8 @@ def check_subscription!(group)
authorize! :admin_group, group
group.remove_avatar! if params.key?(:avatar) && params[:avatar].nil?
if update_group(group)
present_group_details(params, group, with_projects: true)
else
......
......@@ -923,6 +923,16 @@ def make_upload_request
expect(json_response['prevent_sharing_groups_outside_hierarchy']).to eq(true)
end
it 'removes the group avatar' do
put api("/groups/#{group1.id}", user1), params: { avatar: '' }
aggregate_failures "testing response" do
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['avatar_url']).to be_nil
expect(group1.reload.avatar_url).to be_nil
end
end
it 'does not update visibility_level if it is restricted' do
stub_application_setting(restricted_visibility_levels: [Gitlab::VisibilityLevel::INTERNAL])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment