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:
authorJan-Gerd Tenberge <janten@gmail.com>2015-10-22 22:43:17 +0300
committerJan-Gerd Tenberge <janten@gmail.com>2015-10-22 22:43:17 +0300
commitb5c19bcc4d02fd498bc95d70c39bd88ec9cdda4b (patch)
tree6eaed47ca3b65dbd622813497b18902666d23d68 /app/helpers/application_helper.rb
parentb32bb377993fb0224ed3bd9294d752d1a82b2ef9 (diff)
parenta7174efaec77e9408900336b5941d9cca1f82ccf (diff)
Fix merge error
Diffstat (limited to 'app/helpers/application_helper.rb')
-rw-r--r--app/helpers/application_helper.rb16
1 files changed, 12 insertions, 4 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 056ffd278f6..596a47938d6 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -35,7 +35,7 @@ module ApplicationHelper
def project_icon(project_id, options = {})
project =
if project_id.is_a?(Project)
- project = project_id
+ project_id
else
Project.find_with_namespace(project_id)
end
@@ -68,13 +68,17 @@ module ApplicationHelper
end
end
- def avatar_icon(user_email = '', size = nil, scale = 2)
- user = User.find_by(email: user_email)
+ def avatar_icon(user_email = nil, size = nil, scale = 2)
+ if user_or_email.is_a?(User)
+ user = user_or_email
+ else
+ user = User.find_by(email: user_or_email)
+ end
if user
user.avatar_url(size) || default_avatar
else
- gravatar_icon(user_email, size, scale)
+ gravatar_icon(user_or_email, size, scales)
end
end
@@ -314,4 +318,8 @@ module ApplicationHelper
html.html_safe
end
+
+ def truncate_first_line(message, length = 50)
+ truncate(message.each_line.first.chomp, length: length) if message
+ end
end