about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorJenkins <jenkins@jenkins.ninjawedding.org>2017-12-07 04:17:14 +0000
committerJenkins <jenkins@jenkins.ninjawedding.org>2017-12-07 04:17:14 +0000
commit744447b3c04d7806e383f0d1ad7a10c73bd667ef (patch)
tree640d74c3586dfe3114b7db3fdb97e2e3d8490843 /lib
parentde5620995175b7c1c0fc458bd78c12d8c5860aad (diff)
parent0c4ca3e549865623fdd35764915814acc8a595e1 (diff)
Merge remote-tracking branch 'tootsuite/master' into glitchsoc/master
Diffstat (limited to 'lib')
-rw-r--r--lib/tasks/mastodon.rake12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/tasks/mastodon.rake b/lib/tasks/mastodon.rake
index 995cf0d6f..0f2cc536a 100644
--- a/lib/tasks/mastodon.rake
+++ b/lib/tasks/mastodon.rake
@@ -326,5 +326,17 @@ namespace :mastodon do
         end
       end
     end
+
+    desc 'Migrate photo preview cards made before 2.1'
+    task migrate_photo_preview_cards: :environment do
+      status_ids = Status.joins(:preview_cards)
+                         .where(preview_cards: { embed_url: '', type: :photo })
+                         .reorder(nil)
+                         .group(:id)
+                         .pluck(:id)
+
+      PreviewCard.where(embed_url: '', type: :photo).delete_all
+      LinkCrawlWorker.push_bulk status_ids
+    end
   end
 end