4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/moist/action_mailer/observer.rb', line 4
def self.delivered_email(message)
moist_enabled = ::Moist.mailer_registry.enabled?(message.mailer_class, message.mailer_action)
return unless moist_enabled
moist = [message.moist_user, message.moist_subscriber]
if moist.any?(&:nil?) && moist.any?
Rails.logger.warn("Moist was skipped, but at least one Moist variable was set.")
Rails.logger.warn("@moist_user: #{message.moist_user.inspect}\n@moist_subscriber:#{message.moist_subscriber}")
return
end
subscriber = ::Moist::CampaignSubscriber.find_by(user: message.moist_user, subscriber: message.moist_subscriber)
mailing = ::Moist::Mailing.find_by(mailer_class: message.mailer_class, mailer_action: message.mailer_action, moist_campaign_subscriber_id: subscriber)
mailing.update_column(:sent_at, Time.current)
end
|