Fix follower and other counters being able to go negative (#18517)
This commit is contained in:
@@ -17,6 +17,18 @@ class StatusStat < ApplicationRecord
|
||||
|
||||
after_commit :reset_parent_cache
|
||||
|
||||
def replies_count
|
||||
[attributes['replies_count'], 0].max
|
||||
end
|
||||
|
||||
def reblogs_count
|
||||
[attributes['reblogs_count'], 0].max
|
||||
end
|
||||
|
||||
def favourites_count
|
||||
[attributes['favourites_count'], 0].max
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def reset_parent_cache
|
||||
|
||||
Reference in New Issue
Block a user