mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-24 11:38:07 +01:00
11b3ee4f4c
* 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
25 lines
681 B
Ruby
25 lines
681 B
Ruby
# frozen_string_literal: true
|
|
# == Schema Information
|
|
#
|
|
# Table name: status_stats
|
|
#
|
|
# id :bigint(8) not null, primary key
|
|
# status_id :bigint(8) not null
|
|
# replies_count :bigint(8) default(0), not null
|
|
# reblogs_count :bigint(8) default(0), not null
|
|
# favourites_count :bigint(8) default(0), not null
|
|
# created_at :datetime not null
|
|
# updated_at :datetime not null
|
|
#
|
|
|
|
class StatusStat < ApplicationRecord
|
|
belongs_to :status, inverse_of: :status_stat
|
|
|
|
after_commit :reset_parent_cache
|
|
|
|
private
|
|
|
|
def reset_parent_cache
|
|
Rails.cache.delete("statuses/#{status_id}")
|
|
end
|
|
end
|