Add embed_url to preview cards (#5775)

This commit is contained in:
Akihiko Odaki authored and Eugen Rochko committed 2017-12-07 03:37:43 +01:00
1 parent 432761f375
commit c083816c24
7 files changed
+38 -9

No files matched your search

+12
View File
@@ -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