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 /lib | |
parent | f5457cc3d2be79525d339dd5a5c046de6d0acf9d (diff) |
Add digest e-mails
Diffstat (limited to 'lib')
-rw-r--r-- | lib/tasks/mastodon.rake | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/tasks/mastodon.rake b/lib/tasks/mastodon.rake index 8482d4124..bb10410b5 100644 --- a/lib/tasks/mastodon.rake +++ b/lib/tasks/mastodon.rake @@ -43,7 +43,7 @@ namespace :mastodon do namespace :feeds do desc 'Clear timelines of inactive users' task clear: :environment do - User.where('current_sign_in_at < ?', 14.days.ago).find_each do |user| + User.confirmed.where('current_sign_in_at < ?', 14.days.ago).find_each do |user| Redis.current.del(FeedManager.instance.key(:home, user.account_id)) end end @@ -53,4 +53,13 @@ namespace :mastodon do Redis.current.keys('feed:*').each { |key| Redis.current.del(key) } end end + + namespace :emails do + desc 'Send out digest e-mails' + task digest: :environment do + User.confirmed.joins(:account).where(accounts: { silenced: false, suspended: false }).where('current_sign_in_at < ?', 20.days.ago).find_each do |user| + DigestMailerWorker.perform_async(user.id) + end + end + end end |