2019-05-02 18:17:27 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-04-04 13:59:22 -04:00
|
|
|
module Jobs
|
2019-10-02 00:01:53 -04:00
|
|
|
class AdminConfirmationEmail < ::Jobs::Base
|
2017-04-04 13:59:22 -04:00
|
|
|
sidekiq_options queue: 'critical'
|
|
|
|
|
|
|
|
def execute(args)
|
|
|
|
to_address = args[:to_address]
|
|
|
|
token = args[:token]
|
2019-11-04 04:17:00 -05:00
|
|
|
target_email = args[:target_email]
|
2017-04-04 13:59:22 -04:00
|
|
|
target_username = args[:target_username]
|
|
|
|
|
|
|
|
raise Discourse::InvalidParameters.new(:to_address) if to_address.blank?
|
|
|
|
raise Discourse::InvalidParameters.new(:token) if token.blank?
|
2019-11-04 04:17:00 -05:00
|
|
|
raise Discourse::InvalidParameters.new(:target_email) if target_email.blank?
|
2017-04-04 13:59:22 -04:00
|
|
|
raise Discourse::InvalidParameters.new(:target_username) if target_username.blank?
|
|
|
|
|
2019-11-04 04:17:00 -05:00
|
|
|
message = AdminConfirmationMailer.send_email(to_address, target_email, target_username, token)
|
2017-04-04 13:59:22 -04:00
|
|
|
Email::Sender.new(message, :admin_confirmation_message).send
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|