Skip to content
Snippets Groups Projects
Commit 83a9a472 authored by vanadium23's avatar vanadium23
Browse files

Accept image for avatar in user API

parent f2505eb6
No related branches found
No related tags found
No related merge requests found
---
title: Accept image for avatar in user API
merge_request: 12143
author: Ivan Chernov
Loading
Loading
@@ -251,6 +251,7 @@ Parameters:
- `can_create_group` (optional) - User can create groups - true or false
- `confirm` (optional) - Require confirmation - true (default) or false
- `external` (optional) - Flags the user as external - true or false(default)
- `avatar` (optional) - Image file for user's avatar
 
## User modification
 
Loading
Loading
@@ -279,6 +280,7 @@ Parameters:
- `admin` (optional) - User is admin - true or false (default)
- `can_create_group` (optional) - User can create groups - true or false
- `external` (optional) - Flags the user as external - true or false(default)
- `avatar` (optional) - Image file for user's avatar
 
On password update, user will be forced to change it upon next login.
Note, at the moment this method does only return a `404` error,
Loading
Loading
Loading
Loading
@@ -29,6 +29,7 @@ module API
optional :can_create_group, type: Boolean, desc: 'Flag indicating the user can create groups'
optional :skip_confirmation, type: Boolean, default: false, desc: 'Flag indicating the account is confirmed'
optional :external, type: Boolean, desc: 'Flag indicating the user is an external user'
optional :avatar, type: File, desc: 'Avatar image for user'
all_or_none_of :extern_uid, :provider
end
end
Loading
Loading
Loading
Loading
@@ -377,6 +377,16 @@ describe API::Users do
expect(user.reload.organization).to eq('GitLab')
end
 
it 'updates user with avatar' do
put api("/users/#{user.id}", admin), { avatar: fixture_file_upload(Rails.root + 'spec/fixtures/banana_sample.gif', 'image/gif') }
user.reload
expect(user.avatar).to be_present
expect(response).to have_http_status(200)
expect(json_response['avatar_url']).to include(user.avatar_path)
end
it 'updates user with his own email' do
put api("/users/#{user.id}", admin), email: user.email
expect(response).to have_http_status(200)
Loading
Loading
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