summaryrefslogtreecommitdiff
path: root/app/workers
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2016-05-12 16:06:14 +0100
committerSean McGivern <sean@gitlab.com>2016-05-17 13:23:17 +0100
commita9977f2b7a39d57d0633714616b4653aca103993 (patch)
tree40a8cb2fad0e80a01b056afe8be70c2b82f33b5e /app/workers
parent28eea9bdfd0b28ad044f76bd4fcf988329ca9921 (diff)
downloadgitlab-ce-a9977f2b7a39d57d0633714616b4653aca103993.tar.gz
Syntax-highlight diffs in push emails17464-backport-email-syntax-highlighting
Based on: https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/151
Diffstat (limited to 'app/workers')
-rw-r--r--app/workers/emails_on_push_worker.rb18
1 files changed, 11 insertions, 7 deletions
diff --git a/app/workers/emails_on_push_worker.rb b/app/workers/emails_on_push_worker.rb
index 6ebcba5f39b..fa959fc56e3 100644
--- a/app/workers/emails_on_push_worker.rb
+++ b/app/workers/emails_on_push_worker.rb
@@ -27,15 +27,18 @@ class EmailsOnPushWorker
:push
end
+ diff_refs = nil
compare = nil
reverse_compare = false
if action == :push
compare = Gitlab::Git::Compare.new(project.repository.raw_repository, before_sha, after_sha)
+ diff_refs = [project.merge_base_commit(before_sha, after_sha), project.commit(after_sha)]
return false if compare.same
if compare.commits.empty?
compare = Gitlab::Git::Compare.new(project.repository.raw_repository, after_sha, before_sha)
+ diff_refs = [project.merge_base_commit(after_sha, before_sha), project.commit(before_sha)]
reverse_compare = true
@@ -48,13 +51,14 @@ class EmailsOnPushWorker
send_email(
recipient,
project_id,
- author_id: author_id,
- ref: ref,
- action: action,
- compare: compare,
- reverse_compare: reverse_compare,
- send_from_committer_email: send_from_committer_email,
- disable_diffs: disable_diffs
+ author_id: author_id,
+ ref: ref,
+ action: action,
+ compare: compare,
+ reverse_compare: reverse_compare,
+ diff_refs: diff_refs,
+ send_from_committer_email: send_from_committer_email,
+ disable_diffs: disable_diffs
)
# These are input errors and won't be corrected even if Sidekiq retries