gab-social/app/workers/expire_account_pro_worker.rb
mgabdev 991dd7a743 Added ExpiringProScheduler with email for expired GabPRO users
• Added:
- ExpiringProScheduler with email for expired GabPRO users
2020-08-31 19:50:02 -05:00

24 lines
401 B
Ruby

# frozen_string_literal: true
class ExpireAccountProWorker
include Sidekiq::Worker
sidekiq_options queue: 'mailers', retry: 2
attr_reader :user
def perform(acct_id)
@acct = Account.find(acct_id)
@acct.update(is_pro: false)
deliver_email
end
private
def deliver_email
UserMailer.pro_expired(@acct.user).deliver_now!
@acct.user.touch(:last_emailed_at)
end
end