Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
83a9a472
Commit
83a9a472
authored
Jun 13, 2017
by
vanadium23
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Accept image for avatar in user API
parent
f2505eb6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
0 deletions
+17
-0
changelogs/unreleased/26212-upload-user-avatar-trough-api.yml
...gelogs/unreleased/26212-upload-user-avatar-trough-api.yml
+4
-0
doc/api/users.md
doc/api/users.md
+2
-0
lib/api/users.rb
lib/api/users.rb
+1
-0
spec/requests/api/users_spec.rb
spec/requests/api/users_spec.rb
+10
-0
No files found.
changelogs/unreleased/26212-upload-user-avatar-trough-api.yml
0 → 100644
View file @
83a9a472
---
title
:
Accept image for avatar in user API
merge_request
:
12143
author
:
Ivan Chernov
doc/api/users.md
View file @
83a9a472
...
...
@@ -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
...
...
@@ -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,
...
...
lib/api/users.rb
View file @
83a9a472
...
...
@@ -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
...
...
spec/requests/api/users_spec.rb
View file @
83a9a472
...
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment