diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2018-05-04 21:14:34 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-04 21:14:34 +0200 |
commit | 6793bec4c67e695100cb4d8551f0bda0b7e87b12 (patch) | |
tree | 696e35d972dd537bc9b2551cc11eb95a0b6414d2 /app/lib | |
parent | d1aef17f9ad0074458ad0b390ac73db228928f07 (diff) |
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.
Diffstat (limited to 'app/lib')
-rw-r--r-- | app/lib/activitypub/activity/block.rb | 2 | ||||
-rw-r--r-- | app/lib/activitypub/activity/follow.rb | 2 | ||||
-rw-r--r-- | app/lib/activitypub/tag_manager.rb | 4 |
3 files changed, 6 insertions, 2 deletions
diff --git a/app/lib/activitypub/activity/block.rb b/app/lib/activitypub/activity/block.rb index f630d5db2..26da8bdf5 100644 --- a/app/lib/activitypub/activity/block.rb +++ b/app/lib/activitypub/activity/block.rb @@ -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 diff --git a/app/lib/activitypub/activity/follow.rb b/app/lib/activitypub/activity/follow.rb index 8adbbb9c3..fbbf358a8 100644 --- a/app/lib/activitypub/activity/follow.rb +++ b/app/lib/activitypub/activity/follow.rb @@ -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) diff --git a/app/lib/activitypub/tag_manager.rb b/app/lib/activitypub/tag_manager.rb index fa2a8f7d3..908ea9639 100644 --- a/app/lib/activitypub/tag_manager.rb +++ b/app/lib/activitypub/tag_manager.rb @@ -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? |