From 8f54a8851a64ffa3cff4604dc798ff428b6da95e Mon Sep 17 00:00:00 2001
From: Eugen Rochko <eugen@zeonfederated.com>
Date: Thu, 12 Jan 2017 04:19:04 +0100
Subject: [PATCH] Add rake task for clearing out media from silenced accounts

---
 lib/tasks/mastodon.rake | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/tasks/mastodon.rake b/lib/tasks/mastodon.rake
index a95a7258fa..13220f68e3 100644
--- a/lib/tasks/mastodon.rake
+++ b/lib/tasks/mastodon.rake
@@ -6,6 +6,11 @@ namespace :mastodon do
     task clear: :environment do
       MediaAttachment.where(status_id: nil).where('created_at < ?', 1.day.ago).find_each(&:destroy)
     end
+
+    desc 'Remove media attachments attributed to silenced accounts'
+    task remove_silenced: :environment do
+      MediaAttachment.where(account: Account.silenced).find_each(&:destroy)
+    end
   end
 
   namespace :push do
-- 
GitLab