diff options
author | Sean McGivern <sean@gitlab.com> | 2016-05-12 18:06:14 +0300 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2016-05-17 15:23:17 +0300 |
commit | a9977f2b7a39d57d0633714616b4653aca103993 (patch) | |
tree | 40a8cb2fad0e80a01b056afe8be70c2b82f33b5e /lib/gitlab | |
parent | 28eea9bdfd0b28ad044f76bd4fcf988329ca9921 (diff) |
Syntax-highlight diffs in push emails
Based on:
https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/151
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 |