Merge remote-tracking branch 'parent/main' into kb_migration
This commit is contained in:
commit
a8419d83ba
12 changed files with 98 additions and 64 deletions
|
@ -417,6 +417,6 @@ class MediaAttachment < ApplicationRecord
|
|||
end
|
||||
|
||||
def reset_parent_cache
|
||||
Rails.cache.delete("statuses/#{status_id}") if status_id.present?
|
||||
Rails.cache.delete("v3:statuses/#{status_id}") if status_id.present?
|
||||
end
|
||||
end
|
||||
|
|
|
@ -108,7 +108,7 @@ class Poll < ApplicationRecord
|
|||
def reset_parent_cache
|
||||
return if status_id.nil?
|
||||
|
||||
Rails.cache.delete("statuses/#{status_id}")
|
||||
Rails.cache.delete("v3:statuses/#{status_id}")
|
||||
end
|
||||
|
||||
def last_fetched_before_expiration?
|
||||
|
|
|
@ -21,8 +21,6 @@
|
|||
class StatusStat < ApplicationRecord
|
||||
belongs_to :status, inverse_of: :status_stat
|
||||
|
||||
after_commit :reset_parent_cache
|
||||
|
||||
def replies_count
|
||||
[attributes['replies_count'], 0].max
|
||||
end
|
||||
|
@ -50,10 +48,4 @@ class StatusStat < ApplicationRecord
|
|||
def status_referred_by_count
|
||||
[attributes['status_referred_by_count'] || 0, 0].max
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def reset_parent_cache
|
||||
Rails.cache.delete("statuses/#{status_id}")
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue