From e6520c027014aae9444dc58f8b3e7b618214a574 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Wed, 7 Mar 2018 03:54:46 +0100 Subject: [PATCH] Fix #6657 - Use target instead of origin in Remove activity (#6664) --- app/lib/activitypub/activity/remove.rb | 2 +- app/serializers/activitypub/remove_serializer.rb | 4 ++-- spec/lib/activitypub/activity/remove_spec.rb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/lib/activitypub/activity/remove.rb b/app/lib/activitypub/activity/remove.rb index 97cee511687..62a1e3196ef 100644 --- a/app/lib/activitypub/activity/remove.rb +++ b/app/lib/activitypub/activity/remove.rb @@ -2,7 +2,7 @@ class ActivityPub::Activity::Remove < ActivityPub::Activity def perform - return unless @json['origin'].present? && value_or_id(@json['origin']) == @account.featured_collection_url + return unless @json['target'].present? && value_or_id(@json['target']) == @account.featured_collection_url status = status_from_uri(object_uri) diff --git a/app/serializers/activitypub/remove_serializer.rb b/app/serializers/activitypub/remove_serializer.rb index 6da7e35d3d2..c35ee916e64 100644 --- a/app/serializers/activitypub/remove_serializer.rb +++ b/app/serializers/activitypub/remove_serializer.rb @@ -3,7 +3,7 @@ class ActivityPub::RemoveSerializer < ActiveModel::Serializer include RoutingHelper - attributes :type, :actor, :origin + attributes :type, :actor, :target attribute :proper_object, key: :object def type @@ -18,7 +18,7 @@ class ActivityPub::RemoveSerializer < ActiveModel::Serializer ActivityPub::TagManager.instance.uri_for(object) end - def origin + def target account_collection_url(object, :featured) end end diff --git a/spec/lib/activitypub/activity/remove_spec.rb b/spec/lib/activitypub/activity/remove_spec.rb index c3f015053d1..4209dfde202 100644 --- a/spec/lib/activitypub/activity/remove_spec.rb +++ b/spec/lib/activitypub/activity/remove_spec.rb @@ -11,7 +11,7 @@ RSpec.describe ActivityPub::Activity::Remove do type: 'Add', actor: ActivityPub::TagManager.instance.uri_for(sender), object: ActivityPub::TagManager.instance.uri_for(status), - origin: sender.featured_collection_url, + target: sender.featured_collection_url, }.with_indifferent_access end