Skip to content

Commit

Permalink
In remove_remote, exclude removed media attachments. (#5626)
Browse files Browse the repository at this point in the history
  • Loading branch information
yukimochi authored and Gargron committed Nov 8, 2017
1 parent 64cc129 commit 4c0a85e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/tasks/mastodon.rake
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ namespace :mastodon do
task remove_remote: :environment do
time_ago = ENV.fetch('NUM_DAYS') { 7 }.to_i.days.ago

MediaAttachment.where.not(remote_url: '').where('created_at < ?', time_ago).find_each do |media|
MediaAttachment.where.not(remote_url: '').where.not(file_file_name: nil).where('created_at < ?', time_ago).find_each do |media|
media.file.destroy
media.save
end
Expand Down

0 comments on commit 4c0a85e

Please sign in to comment.