aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/action_mailbox/inbound_email/incineratable.rb
blob: 198846422cdf97546bf04dba724a2ebb9f3f14c7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
module ActionMailbox::InboundEmail::Incineratable
  extend ActiveSupport::Concern

  included do
    after_update_commit :incinerate_later, if: -> { status_previously_changed? && processed? }
  end

  def incinerate_later
    ActionMailbox::IncinerationJob.schedule self
  end

  def incinerate
    Incineration.new(self).run
  end
end