diff --git a/app/mailers/emails/projects.rb b/app/mailers/emails/projects.rb index df21d7b5b0245150a872de299a0c7d27c381d046..428d74d83c69fe34a87e85039496f91f8ed49832 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 d0b30c08338d43ee2047ee82b6323fcd8d42015f..ab0d6c653b909c997ddbba8929317583f75d1811 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 6718ca683598c104efa846bc1ab60429ca7b7f65..93b344d2c8285adcec9fa12f7b7f25af0ceb0dba 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 9982b362a1043a4b9af17503ae5fad99703c9fa1..5e81810cbdbfaab0f0968c9dc620b4ca056746e9 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