summaryrefslogtreecommitdiff
path: root/app/decorators/commit_decorator.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dzaporozhets@sphereconsultinginc.com>2012-09-03 08:13:51 +0300
committerDmitriy Zaporozhets <dzaporozhets@sphereconsultinginc.com>2012-09-03 08:15:07 +0300
commitc7cfe3d83bfbad2a074cacb5a4ed8a24244f8f26 (patch)
tree81b4856697186c42da5727c9797c2e8b68b4103f /app/decorators/commit_decorator.rb
parent0c5e556922b4c7ff71c6af6255a0f6783e25ca0c (diff)
downloadgitlab-ce-c7cfe3d83bfbad2a074cacb5a4ed8a24244f8f26.tar.gz
devise session templates to haml. Fix problem with missing message in commit
Diffstat (limited to 'app/decorators/commit_decorator.rb')
-rw-r--r--app/decorators/commit_decorator.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/decorators/commit_decorator.rb b/app/decorators/commit_decorator.rb
index 074176ae802..f813ed253d7 100644
--- a/app/decorators/commit_decorator.rb
+++ b/app/decorators/commit_decorator.rb
@@ -16,6 +16,8 @@ class CommitDecorator < ApplicationDecorator
# In case this first line is longer than 80 characters, it is cut off
# after 70 characters and ellipses (`&hellp;`) are appended.
def title
+ return no_commit_message unless safe_message
+
title_end = safe_message.index(/\n/)
if (!title_end && safe_message.length > 80) || (title_end && title_end > 80)
safe_message[0..69] << "&hellip;".html_safe
@@ -35,4 +37,10 @@ class CommitDecorator < ApplicationDecorator
safe_message.split(/\n/, 2)[1].try(:chomp)
end
end
+
+ protected
+
+ def no_commit_message
+ "--no commit message"
+ end
end