summaryrefslogtreecommitdiff
path: root/app/helpers
diff options
context:
space:
mode:
authorJacob Vosmaer <contact@jacobvosmaer.nl>2016-03-10 09:45:38 +0100
committerJacob Vosmaer <contact@jacobvosmaer.nl>2016-03-10 09:45:38 +0100
commit570f428b89fad526e6f7c9c4afd16a8ced83369a (patch)
tree1fa3f4acced8b921c4105fde193128ecce3fc733 /app/helpers
parent3eb7ea49feaf9341b2eec6eb0c58ae2f0aa37864 (diff)
parent491ac7ce4b79c901e23799d2062f9f013f08c6c3 (diff)
downloadgitlab-ce-redis-config-parser.tar.gz
Merge branch 'master' of https://gitlab.com/gitlab-org/gitlab-ce into redis-config-parserredis-config-parser
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/application_helper.rb2
-rw-r--r--app/helpers/commits_helper.rb11
2 files changed, 12 insertions, 1 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index f0aa2b57121..368969c6472 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -72,7 +72,7 @@ module ApplicationHelper
if user_or_email.is_a?(User)
user = user_or_email
else
- user = User.find_by(email: user_or_email.downcase)
+ user = User.find_by(email: user_or_email.try(:downcase))
end
if user
diff --git a/app/helpers/commits_helper.rb b/app/helpers/commits_helper.rb
index a09e91578b6..f994c9e6170 100644
--- a/app/helpers/commits_helper.rb
+++ b/app/helpers/commits_helper.rb
@@ -211,4 +211,15 @@ module CommitsHelper
def clean(string)
Sanitize.clean(string, remove_contents: true)
end
+
+ def limited_commits(commits)
+ if commits.size > MergeRequestDiff::COMMITS_SAFE_SIZE
+ [
+ commits.first(MergeRequestDiff::COMMITS_SAFE_SIZE),
+ commits.size - MergeRequestDiff::COMMITS_SAFE_SIZE
+ ]
+ else
+ [commits, 0]
+ end
+ end
end