Refactor controllers for statuses, accounts, and more (#11249)
This commit is contained in:
parent
f14776475d
commit
63c7fe8e48
41 changed files with 299 additions and 289 deletions
|
@ -193,7 +193,7 @@ class Status < ApplicationRecord
|
|||
end
|
||||
|
||||
def hidden?
|
||||
private_visibility? || direct_visibility? || limited_visibility?
|
||||
!distributable?
|
||||
end
|
||||
|
||||
def distributable?
|
||||
|
@ -446,7 +446,8 @@ class Status < ApplicationRecord
|
|||
end
|
||||
|
||||
def update_statistics
|
||||
return unless public_visibility? || unlisted_visibility?
|
||||
return unless distributable?
|
||||
|
||||
ActivityTracker.increment('activity:statuses:local')
|
||||
end
|
||||
|
||||
|
@ -455,7 +456,7 @@ class Status < ApplicationRecord
|
|||
|
||||
account&.increment_count!(:statuses_count)
|
||||
reblog&.increment_count!(:reblogs_count) if reblog?
|
||||
thread&.increment_count!(:replies_count) if in_reply_to_id.present? && (public_visibility? || unlisted_visibility?)
|
||||
thread&.increment_count!(:replies_count) if in_reply_to_id.present? && distributable?
|
||||
end
|
||||
|
||||
def decrement_counter_caches
|
||||
|
@ -463,7 +464,7 @@ class Status < ApplicationRecord
|
|||
|
||||
account&.decrement_count!(:statuses_count)
|
||||
reblog&.decrement_count!(:reblogs_count) if reblog?
|
||||
thread&.decrement_count!(:replies_count) if in_reply_to_id.present? && (public_visibility? || unlisted_visibility?)
|
||||
thread&.decrement_count!(:replies_count) if in_reply_to_id.present? && distributable?
|
||||
end
|
||||
|
||||
def unlink_from_conversations
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue