logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

digest_mailer_worker.rb (383B)


  1. # frozen_string_literal: true
  2. class DigestMailerWorker
  3. include Sidekiq::Worker
  4. sidekiq_options queue: 'mailers'
  5. attr_reader :user
  6. def perform(user_id)
  7. @user = User.find(user_id)
  8. deliver_digest if @user.allows_digest_emails?
  9. end
  10. private
  11. def deliver_digest
  12. NotificationMailer.digest(user.account).deliver_now!
  13. user.touch(:last_emailed_at)
  14. end
  15. end