about summary refs log tree commit diff
path: root/app/workers
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2022-01-17 09:41:33 +0100
committerGitHub <noreply@github.com>2022-01-17 09:41:33 +0100
commit14f436c457560862fafabd753eb314c8b8a8e674 (patch)
tree905e62fd68c52efc9eec5b63d7170eee0c0c93a7 /app/workers
parentd5c9feb7b7fc489afbd0a287431fe07b42451ef0 (diff)
Add notifications for statuses deleted by moderators (#17204)
Diffstat (limited to 'app/workers')
-rw-r--r--app/workers/scheduler/user_cleanup_scheduler.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/app/workers/scheduler/user_cleanup_scheduler.rb b/app/workers/scheduler/user_cleanup_scheduler.rb
index be0c4277d..d06b637f9 100644
--- a/app/workers/scheduler/user_cleanup_scheduler.rb
+++ b/app/workers/scheduler/user_cleanup_scheduler.rb
@@ -8,6 +8,7 @@ class Scheduler::UserCleanupScheduler
   def perform
     clean_unconfirmed_accounts!
     clean_suspended_accounts!
+    clean_discarded_statuses!
   end
 
   private
@@ -24,4 +25,12 @@ class Scheduler::UserCleanupScheduler
       Admin::AccountDeletionWorker.perform_async(deletion_request.account_id)
     end
   end
+
+  def clean_discarded_statuses!
+    Status.discarded.where('deleted_at <= ?', 30.days.ago).find_in_batches do |statuses|
+      RemovalWorker.push_bulk(statuses) do |status|
+        [status.id, { immediate: true }]
+      end
+    end
+  end
 end