Store URIs of follows, follow requests and blocks for ActivityPub (#7160)
Same URI passed between follow request and follow, since they are the same thing in ActivityPub. Local URIs are generated during creation using UUIDs and are passed to serializers.
This commit is contained in:
parent
d1aef17f9a
commit
6793bec4c6
11 changed files with 64 additions and 13 deletions
|
@ -7,6 +7,6 @@ class ActivityPub::Activity::Block < ActivityPub::Activity
|
|||
return if target_account.nil? || !target_account.local? || delete_arrived_first?(@json['id']) || @account.blocking?(target_account)
|
||||
|
||||
UnfollowService.new.call(target_account, @account) if target_account.following?(@account)
|
||||
@account.block!(target_account)
|
||||
@account.block!(target_account, uri: @json['id'])
|
||||
end
|
||||
end
|
||||
|
|
|
@ -12,7 +12,7 @@ class ActivityPub::Activity::Follow < ActivityPub::Activity
|
|||
return
|
||||
end
|
||||
|
||||
follow_request = FollowRequest.create!(account: @account, target_account: target_account)
|
||||
follow_request = FollowRequest.create!(account: @account, target_account: target_account, uri: @json['id'])
|
||||
|
||||
if target_account.locked?
|
||||
NotifyService.new.call(target_account, follow_request)
|
||||
|
|
|
@ -38,6 +38,10 @@ class ActivityPub::TagManager
|
|||
end
|
||||
end
|
||||
|
||||
def generate_uri_for(_target)
|
||||
URI.join(root_url, 'payloads', SecureRandom.uuid)
|
||||
end
|
||||
|
||||
def activity_uri_for(target)
|
||||
raise ArgumentError, 'target must be a local activity' unless %i(note comment activity).include?(target.object_type) && target.local?
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue