Skip to content

Commit

Permalink
send mail to all users
Browse files Browse the repository at this point in the history
  • Loading branch information
jack-coggin committed Aug 24, 2023
1 parent 2119ddf commit a8055ad
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion app/jobs/new_module_mail_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ def run(release_id)
return if find_module.nil?

notify_users(new_module)
# TODO: uncomment before merging
# create_published_record(new_module, Release.find(release_id))
log "NewModuleMailJob contacted #{User.count} users"
Sentry.capture_message("NewModuleMailJob contacted #{User.count} users", level: :info) if Rails.application.live?
Expand All @@ -25,7 +26,8 @@ def create_published_record(mod, release)
# @param mod [Training::Module]
# @return [void]
def notify_users(mod)
User.completed_available_modules.each { |recipient| NotifyMailer.new_module(recipient, mod) }
# User.completed_available_modules.each { |recipient| NotifyMailer.new_module(recipient, mod) }
User.all.each { |recipient| NotifyMailer.new_module(recipient, mod) }
end

# @return [Training::Module, nil]
Expand Down
5 changes: 3 additions & 2 deletions spec/jobs/new_module_mail_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
end

it 'emails the correct users' do
expected = [user]
excluded = [user_2]
expected = [user, user_2]
# excluded = [user_2]
excluded = []
expect(described_class.run(release_2.id)).to send_expected_emails(
mailer_method: :new_module,
expected_users: expected,
Expand Down

0 comments on commit a8055ad

Please sign in to comment.