diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2018-03-08 06:59:42 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-08 06:59:42 +0100 |
commit | 64db9ed5f6c8ff826104b3294956416d08d7a135 (patch) | |
tree | f638f306e9c4546863b5ad53cf14c4ee89f0e645 /lib | |
parent | 1085ef38365facd52ca0f49046ee1d55b3763dcc (diff) |
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.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/tasks/mastodon.rake | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/tasks/mastodon.rake b/lib/tasks/mastodon.rake index 9202b4839..0b011bf57 100644 --- a/lib/tasks/mastodon.rake +++ b/lib/tasks/mastodon.rake @@ -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 |