diff options
author | Douwe Maan <douwe@gitlab.com> | 2016-05-20 00:12:53 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2016-05-20 00:12:53 +0300 |
commit | 18ef054bc7eb14a7b817af5f66f140f2f3dd4ae6 (patch) | |
tree | eae7f19fb7c8f6b5009546ef3224e2558bd26560 /lib/gitlab | |
parent | c50e7b1202f8a8534719ae266a53893e1ab3a2fa (diff) | |
parent | a9977f2b7a39d57d0633714616b4653aca103993 (diff) |
Merge branch '17464-backport-email-syntax-highlighting' into 'master'
Syntax-highlight diffs in push emails
![image](/uploads/8ecbabc65382214b8de63aae24f66cea/image.png)
Based on:
https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/151
See merge request !4147
Diffstat (limited to 'lib/gitlab')
-rw-r--r-- | lib/gitlab/email/message/repository_push.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/gitlab/email/message/repository_push.rb b/lib/gitlab/email/message/repository_push.rb index 2c91a0487c3..e2fee6b9f3e 100644 --- a/lib/gitlab/email/message/repository_push.rb +++ b/lib/gitlab/email/message/repository_push.rb @@ -5,6 +5,7 @@ module Gitlab attr_reader :author_id, :ref, :action include Gitlab::Routing.url_helpers + include DiffHelper delegate :namespace, :name_with_namespace, to: :project, prefix: :project delegate :name, to: :author, prefix: :author @@ -36,7 +37,7 @@ module Gitlab end def diffs - @diffs ||= (compare.diffs if compare) + @diffs ||= (safe_diff_files(compare.diffs, diff_refs) if compare) end def diffs_count @@ -47,6 +48,10 @@ module Gitlab @opts[:compare] end + def diff_refs + @opts[:diff_refs] + end + def compare_timeout diffs.overflow? if diffs end |