diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2017-03-03 23:45:48 +0100 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2017-03-04 00:00:48 +0100 |
commit | 6b81d100306259cd17b38d3f0f9dec0f0fb5b5d9 (patch) | |
tree | a6d40da1644804061eaeacdfd748d027aac2c41b /app/workers | |
parent | f5457cc3d2be79525d339dd5a5c046de6d0acf9d (diff) |
Add digest e-mails
Diffstat (limited to 'app/workers')
-rw-r--r-- | app/workers/digest_mailer_worker.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/app/workers/digest_mailer_worker.rb b/app/workers/digest_mailer_worker.rb new file mode 100644 index 000000000..dedb21e4e --- /dev/null +++ b/app/workers/digest_mailer_worker.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +class DigestMailerWorker + include Sidekiq::Worker + + sidekiq_options queue: 'mailers' + + def perform(user_id) + user = User.find(user_id) + return unless user.settings.notification_emails['digest'] + NotificationMailer.digest(user.account).deliver_now! + user.touch(:last_emailed_at) + end +end |