diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-08 06:09:25 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-08 06:09:25 +0300 |
commit | 10646673020797d5194d39188b135a3a6f19b860 (patch) | |
tree | f0063690a4496dbeade7e7f38219b35984f8e769 /lib/gitlab | |
parent | 4bd833592f8fefc80d9f4dcdec7305249efef183 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab')
-rw-r--r-- | lib/gitlab/seeder.rb | 36 |
1 files changed, 15 insertions, 21 deletions
diff --git a/lib/gitlab/seeder.rb b/lib/gitlab/seeder.rb index 4158cec9b09..5671fce481f 100644 --- a/lib/gitlab/seeder.rb +++ b/lib/gitlab/seeder.rb @@ -1,17 +1,5 @@ # frozen_string_literal: true -# :nocov: -module DeliverNever - def deliver_later - self - end -end - -module MuteNotifications - def new_note(note) - end -end - module Gitlab class Seeder extend ActionView::Helpers::NumberHelper @@ -82,18 +70,22 @@ module Gitlab Project.include(ProjectSeed) User.include(UserSeed) - mute_notifications - mute_mailer + old_perform_deliveries = ActionMailer::Base.perform_deliveries + ActionMailer::Base.perform_deliveries = false SeedFu.quiet = true without_statement_timeout do - yield + without_new_note_notifications do + yield + end end + puts "\nOK".color(:green) + ensure SeedFu.quiet = false + ActionMailer::Base.perform_deliveries = old_perform_deliveries ActiveRecord::Base.logger = old_logger - puts "\nOK".color(:green) end def self.without_gitaly_timeout @@ -109,12 +101,14 @@ module Gitlab ApplicationSetting.expire end - def self.mute_notifications - NotificationService.prepend(MuteNotifications) - end + def self.without_new_note_notifications + NotificationService.alias_method :original_new_note, :new_note + NotificationService.define_method(:new_note) { |note| } - def self.mute_mailer - ActionMailer::MessageDelivery.prepend(DeliverNever) + yield + ensure + NotificationService.alias_method :new_note, :original_new_note + NotificationService.remove_method :original_new_note end def self.without_statement_timeout |