diff options
author | skv-headless <skv-headless@yandex.ru> | 2014-02-25 17:54:30 +0400 |
---|---|---|
committer | skv-headless <skv-headless@yandex.ru> | 2014-02-25 18:23:23 +0400 |
commit | 2c28dbd2547d77054b0a080af6b0dfec674ad799 (patch) | |
tree | ac02f4d1536b1a59c8f38872eb08bfe57d224f20 /app/models/commit.rb | |
parent | 5f31caa0ed88b0d779336d909dc7f48b9f86cd25 (diff) |
commit description in commit list
Diffstat (limited to 'app/models/commit.rb')
-rw-r--r-- | app/models/commit.rb | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/app/models/commit.rb b/app/models/commit.rb index bcc1bcbd96a..c313aeb7572 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -99,14 +99,16 @@ class Commit # # cut off, ellipses (`&hellp;`) are prepended to the commit message. def description - description = safe_message + title_end = safe_message.index(/\n/) + @description ||= if (!title_end && safe_message.length > 100) || (title_end && title_end > 100) + "…".html_safe << safe_message[80..-1] + else + safe_message.split(/\n/, 2)[1].try(:chomp) + end + end - title_end = description.index(/\n/) - if (!title_end && description.length > 100) || (title_end && title_end > 100) - "…".html_safe << description[80..-1] - else - description.split(/\n/, 2)[1].try(:chomp) - end + def description? + description.present? end # Regular expression that identifies commit message clauses that trigger issue closing. |