闭社主体 forked from https://github.com/tootsuite/mastodon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
383 B

  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