Merge branch '48537-update-avatar-only-via-api' into 'master'

Resolve "PUT /projects/:id : unable to update avatar alone"

Closes #48537

See merge request gitlab-org/gitlab-ce!20505
This commit is contained in:
Rémy Coutable 2018-07-10 08:44:20 +00:00
commit f5f5a4e677
3 changed files with 21 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
title: Allow updating a project's avatar without other params
merge_request:
author: Jamie Schembri
type: fixed

View file

@ -260,7 +260,8 @@ module API
:snippets_enabled,
:tag_list,
:visibility,
:wiki_enabled
:wiki_enabled,
:avatar
]
optional :name, type: String, desc: 'The name of the project'
optional :default_branch, type: String, desc: 'The default branch of the project'

View file

@ -1526,6 +1526,20 @@ describe API::Projects do
expect(response).to have_gitlab_http_status(400)
end
it 'updates avatar' do
project_param = {
avatar: fixture_file_upload('spec/fixtures/banana_sample.gif',
'image/gif')
}
put api("/projects/#{project3.id}", user), project_param
expect(response).to have_gitlab_http_status(200)
expect(json_response['avatar_url']).to eq('http://localhost/uploads/'\
'-/system/project/avatar/'\
"#{project3.id}/banana_sample.gif")
end
end
context 'when authenticated as project master' do