From a7345e368a92396c04e9cd8d1a9c1ed2ed50d15e Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 13 Jun 2014 18:02:42 +0300 Subject: [PATCH] Fix gravatar size and update docs for new users API Signed-off-by: Dmitriy Zaporozhets --- app/models/user.rb | 2 +- doc/api/users.md | 53 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/app/models/user.rb b/app/models/user.rb index 6ad337c57ae..2352f8c050b 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -487,7 +487,7 @@ class User < ActiveRecord::Base if avatar.present? URI::join(Gitlab.config.gitlab.url, avatar.url).to_s else - GravatarService.new.execute(email) + GravatarService.new.execute(email, size) end end end diff --git a/doc/api/users.md b/doc/api/users.md index 94af37629ff..4ddbf739774 100644 --- a/doc/api/users.md +++ b/doc/api/users.md @@ -6,6 +6,34 @@ Get a list of users. This function takes pagination parameters `page` and `per_page` to restrict the list of users. +### For normal users: + +``` +GET /users +``` + +```json +[ + { + "id": 1, + "username": "john_smith", + "name": "John Smith", + "state": "active", + "avatar_url": "http://localhost:3000/uploads/user/avatar/1/cd8.jpeg", + }, + { + "id": 2, + "username": "jack_smith", + "name": "Jack Smith", + "state": "blocked", + "avatar_url": "http://gravatar.com/../e32131cd8.jpeg", + } +] +``` + + +### For admins: + ``` GET /users ``` @@ -29,6 +57,7 @@ GET /users "theme_id": 1, "color_scheme_id": 2, "is_admin": false, + "avatar_url": "http://localhost:3000/uploads/user/avatar/1/cd8.jpeg", "can_create_group": true }, { @@ -48,6 +77,7 @@ GET /users "theme_id": 1, "color_scheme_id": 3, "is_admin": false, + "avatar_url": "http://localhost:3000/uploads/user/avatar/1/cd8.jpeg", "can_create_group": true, "can_create_project": true } @@ -62,6 +92,29 @@ Also see `def search query` in `app/models/user.rb`. Get a single user. +#### For user: + +``` +GET /users/:id +``` + +Parameters: + +- `id` (required) - The ID of a user + +```json +{ + "id": 1, + "username": "john_smith", + "name": "John Smith", + "state": "active", + "avatar_url": "http://localhost:3000/uploads/user/avatar/1/cd8.jpeg", +} +``` + + +#### For admin: + ``` GET /users/:id ``` -- GitLab