Commit 4f44717d authored by Sean McGivern's avatar Sean McGivern

Merge branch 'rs-dev-seed-time' into 'master'

Fix the `Gitlab::Seeder` monkey patch to disable mail delivery

Closes #27609

See merge request !9678
parents 320ef318 a0ab45d0
require './spec/support/sidekiq' require './spec/support/sidekiq'
Gitlab::Seeder.quiet do Gitlab::Seeder.quiet do
Issue.all.each do |issue| Issue.find_each do |issue|
project = issue.project project = issue.project
project.team.users.each do |user| project.team.users.each do |user|
...@@ -16,7 +16,7 @@ Gitlab::Seeder.quiet do ...@@ -16,7 +16,7 @@ Gitlab::Seeder.quiet do
end end
end end
MergeRequest.all.each do |mr| MergeRequest.find_each do |mr|
project = mr.project project = mr.project
project.team.users.each do |user| project.team.users.each do |user|
......
module DeliverNever
def deliver_later
self
end
end
module Gitlab module Gitlab
class Seeder class Seeder
def self.quiet def self.quiet
mute_mailer mute_mailer
SeedFu.quiet = true SeedFu.quiet = true
yield yield
SeedFu.quiet = false SeedFu.quiet = false
puts "\nOK".color(:green) puts "\nOK".color(:green)
end end
def self.by_user(user)
yield
end
def self.mute_mailer def self.mute_mailer
code = <<-eos ActionMailer::MessageDelivery.prepend(DeliverNever)
def Notify.deliver_later
self
end
eos
eval(code) # rubocop:disable Security/Eval
end end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment