Merge remote-tracking branch 'parent/main' into upstream-20240117
This commit is contained in:
commit
5d79bd078c
150 changed files with 2982 additions and 1485 deletions
|
@ -5,6 +5,7 @@ class ActivityPub::Activity::Announce < ActivityPub::Activity
|
|||
|
||||
def perform
|
||||
return reject_payload! if delete_arrived_first?(@json['id']) || !related_to_local_activity?
|
||||
return reject_payload! if @object.nil?
|
||||
|
||||
with_redis_lock("announce:#{value_or_id(@object)}") do
|
||||
original_status = status_from_object
|
||||
|
|
|
@ -98,8 +98,34 @@ class ActivityPub::TagManager
|
|||
account_status_shares_url(target.account, target)
|
||||
end
|
||||
|
||||
def followers_uri_for(target)
|
||||
target.local? ? account_followers_url(target) : target.followers_url.presence
|
||||
def following_uri_for(target, ...)
|
||||
raise ArgumentError, 'target must be a local account' unless target.local?
|
||||
|
||||
account_following_index_url(target, ...)
|
||||
end
|
||||
|
||||
def followers_uri_for(target, ...)
|
||||
return target.followers_url.presence unless target.local?
|
||||
|
||||
account_followers_url(target, ...)
|
||||
end
|
||||
|
||||
def collection_uri_for(target, ...)
|
||||
raise NotImplementedError unless target.local?
|
||||
|
||||
account_collection_url(target, ...)
|
||||
end
|
||||
|
||||
def inbox_uri_for(target)
|
||||
raise NotImplementedError unless target.local?
|
||||
|
||||
target.instance_actor? ? instance_actor_inbox_url : account_inbox_url(target)
|
||||
end
|
||||
|
||||
def outbox_uri_for(target, ...)
|
||||
raise NotImplementedError unless target.local?
|
||||
|
||||
target.instance_actor? ? instance_actor_outbox_url(...) : account_outbox_url(target, ...)
|
||||
end
|
||||
|
||||
# Primary audience of a status
|
||||
|
@ -111,9 +137,9 @@ class ActivityPub::TagManager
|
|||
when 'public'
|
||||
[COLLECTIONS[:public]]
|
||||
when 'unlisted', 'public_unlisted', 'private'
|
||||
[account_followers_url(status.account)]
|
||||
[followers_uri_for(status.account)]
|
||||
when 'login'
|
||||
[account_followers_url(status.account), 'as:LoginOnly', 'kmyblue:LoginOnly', 'LoginUser']
|
||||
[followers_uri_for(status.account), 'as:LoginOnly', 'kmyblue:LoginOnly', 'LoginUser']
|
||||
when 'direct'
|
||||
if status.account.silenced?
|
||||
# Only notify followers if the account is locally silenced
|
||||
|
@ -156,7 +182,7 @@ class ActivityPub::TagManager
|
|||
|
||||
case status.visibility
|
||||
when 'public'
|
||||
cc << account_followers_url(status.account)
|
||||
cc << followers_uri_for(status.account)
|
||||
when 'unlisted', 'public_unlisted'
|
||||
cc << COLLECTIONS[:public]
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue