diff options
author | blackst0ne <blackst0ne.ru@gmail.com> | 2017-05-10 15:26:17 +1100 |
---|---|---|
committer | blackst0ne <blackst0ne.ru@gmail.com> | 2017-05-10 15:26:17 +1100 |
commit | 29a3203b3fe08649b80def65b7750a866454d3d6 (patch) | |
tree | d4e644c142b1ecc6dd869c636ad5657c546d901b /app/models/user.rb | |
parent | ecc6cc8be75b5c66fdf7f5595b71aabf9366a5e1 (diff) | |
download | gitlab-ce-29a3203b3fe08649b80def65b7750a866454d3d6.tar.gz |
Use relative paths for group/project/user avatars
Diffstat (limited to 'app/models/user.rb')
-rw-r--r-- | app/models/user.rb | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index 77b2b12ee0b..f713a20233c 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -5,6 +5,7 @@ class User < ActiveRecord::Base include Gitlab::ConfigHelper include Gitlab::CurrentSettings + include Avatarable include Referable include Sortable include CaseSensitivity @@ -784,12 +785,10 @@ class User < ActiveRecord::Base email.start_with?('temp-email-for-oauth') end - def avatar_url(size = nil, scale = 2) - if self[:avatar].present? - [gitlab_config.url, avatar.url].join - else - GravatarService.new.execute(email, size, scale) - end + def avatar_url(size: nil, scale: 2, **args) + # We use avatar_path instead of overriding avatar_url because of carrierwave. + # See https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/11001/diffs#note_28659864 + avatar_path(args) || GravatarService.new.execute(email, size, scale) end def all_emails |