discourse/app/jobs/regular/invite_email.rb
Louis Rose 1574485443 Perform the where(...).first to find_by(...) refactoring.
This refactoring was automated using the command: bundle exec "ruby refactorings/where_dot_first_to_find_by/app.rb"
2014-05-06 14:41:59 +01:00

19 lines
396 B
Ruby

require_dependency 'email/sender'
module Jobs
# Asynchronously send an email
class InviteEmail < Jobs::Base
def execute(args)
raise Discourse::InvalidParameters.new(:invite_id) unless args[:invite_id].present?
invite = Invite.find_by(id: args[:invite_id])
message = InviteMailer.send_invite(invite)
Email::Sender.new(message, :invite).send
end
end
end