Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-10-14 21:06:24 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-10-14 21:06:24 +0300
commit8c30d396c5a789080345303330069981aa06e4af (patch)
tree6fd96c7c80bec2f1101af34d749ada58e59b38ee /app/helpers/avatars_helper.rb
parent429d1abad29d379d8bc8f5219eb72384ad485deb (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/helpers/avatars_helper.rb')
-rw-r--r--app/helpers/avatars_helper.rb23
1 files changed, 13 insertions, 10 deletions
diff --git a/app/helpers/avatars_helper.rb b/app/helpers/avatars_helper.rb
index b7f7e617825..733d21daec1 100644
--- a/app/helpers/avatars_helper.rb
+++ b/app/helpers/avatars_helper.rb
@@ -56,16 +56,6 @@ module AvatarsHelper
}))
end
- def user_avatar_url_for(only_path: true, **options)
- if options[:url]
- options[:url]
- elsif options[:user]
- avatar_icon_for_user(options[:user], options[:size], only_path: only_path)
- else
- avatar_icon_for_email(options[:user_email], options[:size], only_path: only_path)
- end
- end
-
def user_avatar_without_link(options = {})
avatar_size = options[:size] || 16
user_name = options[:user].try(:name) || options[:user_name]
@@ -111,6 +101,19 @@ module AvatarsHelper
private
+ def user_avatar_url_for(only_path: true, **options)
+ return options[:url] if options[:url]
+
+ email = options[:user_email]
+ user = options.key?(:user) ? options[:user] : User.find_by_any_email(email)
+
+ if user
+ avatar_icon_for_user(user, options[:size], only_path: only_path)
+ else
+ gravatar_icon(email, options[:size])
+ end
+ end
+
def source_icon(source, options = {})
avatar_url = source.try(:avatar_url)