0
0
Fork 0

Reset status cache when status_stat or media_attachment updates (#9119)

* Reset status cache when status_stat or media_attachment updates

Fix #8711

Media attachments are generally immutable, but admins can update
the sensitive flag, and this would ensure the change is visible
instantly. Same for updates to status stats. That is a regression
from #8185, because even the correct updated_at fetched from a join
doesn't seem to invalidate the cache.

* Remove join from Status#cache_ids since it has no effect
This commit is contained in:
Eugen Rochko 2018-10-28 06:42:34 +01:00 committed by GitHub
parent 93a1ab9030
commit 11b3ee4f4c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 4 deletions

View file

@ -240,10 +240,6 @@ class Status < ApplicationRecord
before_validation :set_local
class << self
def cache_ids
left_outer_joins(:status_stat).select('statuses.id, greatest(statuses.updated_at, status_stats.updated_at) AS updated_at')
end
def selectable_visibilities
visibilities.keys - %w(direct limited)
end