File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ def perform
1717 uri : @json [ 'id' ] ,
1818 created_at : @json [ 'published' ] ,
1919 override_timestamps : @options [ :override_timestamps ] ,
20- visibility : original_status . visibility
20+ visibility : visibility_from_audience
2121 )
2222
2323 distribute ( status )
@@ -26,6 +26,18 @@ def perform
2626
2727 private
2828
29+ def visibility_from_audience
30+ if equals_or_includes? ( @json [ 'to' ] , ActivityPub ::TagManager ::COLLECTIONS [ :public ] )
31+ :public
32+ elsif equals_or_includes? ( @json [ 'cc' ] , ActivityPub ::TagManager ::COLLECTIONS [ :public ] )
33+ :unlisted
34+ elsif equals_or_includes? ( @json [ 'to' ] , @account . followers_url )
35+ :private
36+ else
37+ :direct
38+ end
39+ end
40+
2941 def announceable? ( status )
3042 status . account_id == @account . id || status . public_visibility? || status . unlisted_visibility?
3143 end
Original file line number Diff line number Diff line change @@ -478,15 +478,15 @@ def increment_counter_caches
478478 return if direct_visibility?
479479
480480 account &.increment_count! ( :statuses_count )
481- reblog &.increment_count! ( :reblogs_count ) if reblog?
481+ reblog &.increment_count! ( :reblogs_count ) if reblog? && ( public_visibility? || unlisted_visibility? )
482482 thread &.increment_count! ( :replies_count ) if in_reply_to_id . present? && ( public_visibility? || unlisted_visibility? )
483483 end
484484
485485 def decrement_counter_caches
486486 return if direct_visibility? || marked_for_mass_destruction?
487487
488488 account &.decrement_count! ( :statuses_count )
489- reblog &.decrement_count! ( :reblogs_count ) if reblog?
489+ reblog &.decrement_count! ( :reblogs_count ) if reblog? && ( public_visibility? || unlisted_visibility? )
490490 thread &.decrement_count! ( :replies_count ) if in_reply_to_id . present? && ( public_visibility? || unlisted_visibility? )
491491 end
492492
You can’t perform that action at this time.
0 commit comments