diff options
-rw-r--r-- | app/mailers/emails/projects.rb | 1 | ||||
-rw-r--r-- | app/views/notify/repository_push_email.html.haml | 5 | ||||
-rw-r--r-- | app/views/notify/repository_push_email.text.haml | 5 | ||||
-rw-r--r-- | app/workers/emails_on_push_worker.rb | 4 |
4 files changed, 13 insertions, 2 deletions
diff --git a/app/mailers/emails/projects.rb b/app/mailers/emails/projects.rb index df21d7b5b02..428d74d83c6 100644 --- a/app/mailers/emails/projects.rb +++ b/app/mailers/emails/projects.rb @@ -17,6 +17,7 @@ module Emails def repository_push_email(project_id, recipient, author_id, branch, compare) @project = Project.find(project_id) @author = User.find(author_id) + @compare = compare @commits = Commit.decorate(compare.commits) @diffs = compare.diffs @branch = branch diff --git a/app/views/notify/repository_push_email.html.haml b/app/views/notify/repository_push_email.html.haml index d0b30c08338..ab0d6c653b9 100644 --- a/app/views/notify/repository_push_email.html.haml +++ b/app/views/notify/repository_push_email.html.haml @@ -21,3 +21,8 @@ %pre = diff.diff %br + +- if @compare.timeout + %h5 Huge diff. To prevent performance issues it was hidden +- elsif @compare.commits_over_limit? + %h5 Diff for big amount of commits is disabled diff --git a/app/views/notify/repository_push_email.text.haml b/app/views/notify/repository_push_email.text.haml index 6718ca68359..93b344d2c82 100644 --- a/app/views/notify/repository_push_email.text.haml +++ b/app/views/notify/repository_push_email.text.haml @@ -18,3 +18,8 @@ Diff: = diff.new_path || diff.old_path \===================================== = diff.diff +\ +- if @compare.timeout + Huge diff. To prevent performance issues it was hidden +- elsif @compare.commits_over_limit? + Diff for big amount of commits is disabled diff --git a/app/workers/emails_on_push_worker.rb b/app/workers/emails_on_push_worker.rb index 9982b362a10..5e81810cbdb 100644 --- a/app/workers/emails_on_push_worker.rb +++ b/app/workers/emails_on_push_worker.rb @@ -13,13 +13,13 @@ class EmailsOnPushWorker return true end - compare = Gitlab::Git::Compare.new(project.repository.raw_repository, before_sha, after_sha) + compare = Gitlab::Git::Compare.new(project.repository.raw_repository, before_sha, after_sha, MergeRequestDiff::COMMITS_SAFE_SIZE) # Do not send emails if git compare failed return false unless compare && compare.commits.present? recipients.split(" ").each do |recipient| - Notify.delay.repository_push_email(project_id, recipient, author_id, branch, compare) + Notify.repository_push_email(project_id, recipient, author_id, branch, compare).deliver end end end |