summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2022-01-21 00:31:11 +0000
committerGo MAEDA <maeda@farend.jp>2022-01-21 00:31:11 +0000
commit5d0798c0d1b970a4d34b61906907014c3c304d51 (patch)
tree357294683e2aec0b4dd31c1fab1cd10a728105dc /app
parent7ad7d17a35268cca698086783412f52799703b35 (diff)
downloadredmine-5d0798c0d1b970a4d34b61906907014c3c304d51.tar.gz
redmine-5d0798c0d1b970a4d34b61906907014c3c304d51.zip
Include avatar URL in Users API (#36303).
Contributed by Yuichi HARADA. git-svn-id: http://svn.redmine.org/redmine/trunk@21375 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r--app/views/users/index.api.rsb1
-rw-r--r--app/views/users/show.api.rsb1
2 files changed, 2 insertions, 0 deletions
diff --git a/app/views/users/index.api.rsb b/app/views/users/index.api.rsb
index 4b51ba47a..b617ea91c 100644
--- a/app/views/users/index.api.rsb
+++ b/app/views/users/index.api.rsb
@@ -11,6 +11,7 @@ api.array :users, api_meta(:total_count => @user_count, :offset => @offset, :lim
api.updated_on user.updated_on
api.last_login_on user.last_login_on
api.passwd_changed_on user.passwd_changed_on
+ api.avatar_url gravatar_url(user.mail, {rating: nil, size: nil, default: Setting.gravatar_default}) if Setting.gravatar_enabled?
api.twofa_scheme user.twofa_scheme
render_api_custom_values user.visible_custom_field_values, api
diff --git a/app/views/users/show.api.rsb b/app/views/users/show.api.rsb
index a19a8c637..f6a323265 100644
--- a/app/views/users/show.api.rsb
+++ b/app/views/users/show.api.rsb
@@ -9,6 +9,7 @@ api.user do
api.updated_on @user.updated_on
api.last_login_on @user.last_login_on
api.passwd_changed_on @user.passwd_changed_on
+ api.avatar_url gravatar_url(@user.mail, {rating: nil, size: nil, default: Setting.gravatar_default}) if Setting.gravatar_enabled?
api.twofa_scheme @user.twofa_scheme if User.current.admin? || (User.current == @user)
api.api_key @user.api_key if User.current.admin? || (User.current == @user)
api.status @user.status if User.current.admin?