2020-05-18 05:08:12 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module AsyncDeviseEmail
|
|
|
|
extend ActiveSupport::Concern
|
2022-05-31 05:08:17 -04:00
|
|
|
include AfterCommitQueue
|
2020-05-18 05:08:12 -04:00
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
# Added according to https://github.com/plataformatec/devise/blob/7df57d5081f9884849ca15e4fde179ef164a575f/README.md#activejob-integration
|
|
|
|
def send_devise_notification(notification, *args)
|
|
|
|
return true unless can?(:receive_notifications)
|
|
|
|
|
2022-05-31 05:08:17 -04:00
|
|
|
run_after_commit_or_now do
|
|
|
|
devise_mailer.__send__(notification, self, *args).deliver_later # rubocop:disable GitlabSecurity/PublicSend
|
|
|
|
end
|
2020-05-18 05:08:12 -04:00
|
|
|
end
|
|
|
|
end
|