0
0
Fork 0

After blocking domain with reject_media, invalidate cache (#6679)

Media attachments are part of the association cache of statuses,
since they are presumed to be immutable. Unless this cache is
cleared manually, the statuses will continue to look like they
have media embedded.
This commit is contained in:
Eugen Rochko 2018-03-08 06:59:42 +01:00 committed by GitHub
parent 1085ef3836
commit 64db9ed5f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 15 deletions

View file

@ -476,10 +476,10 @@ namespace :mastodon do
time_ago = ENV.fetch('NUM_DAYS') { 7 }.to_i.days.ago
MediaAttachment.where.not(remote_url: '').where.not(file_file_name: nil).where('created_at < ?', time_ago).find_each do |media|
if media.file.exists?
media.file.destroy
media.save
end
next unless media.file.exists?
media.file.destroy
media.save
end
end