From 10f1f1a60fc696c1be770e9f571741ece61f5d38 Mon Sep 17 00:00:00 2001 From: Mike Macgirvin Date: Tue, 2 Apr 2024 07:29:38 +1100 Subject: [PATCH] clarifications to container doc --- doc/develop/en/Containers.mc | 5 +++-- src/Lib/Activity.php | 5 ++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/develop/en/Containers.mc b/doc/develop/en/Containers.mc index 5fb610ebe..1d669c3a7 100644 --- a/doc/develop/en/Containers.mc +++ b/doc/develop/en/Containers.mc @@ -21,11 +21,12 @@ In the conversational model, the same basic steps occur, but respects the rights A constrained conversation is implemented as a Collection. [FEP-400e](https://codeberg.org/fediverse/fep/src/branch/main/fep/400e/fep-400e.md) provides a model for working with collections. In that proposal, ActivityPub objects which are created as part of a collection are indicated by a `target` "stub" property containing -- type -- ( `Collection` or `OrderedCollection` ) +- type -- ( `Collection` or `OrderedCollection` of activities) - id -- a URL where this collection can be found - attributedTo -- the `id` of the collection owner -In a constrained conversation, conforming implementations will implement FEP-400e with some very minor additions: +In a constrained conversation, conforming implementations will implement FEP-400e with some very minor additions: +- The collection contains complete activities, not simple objects. - In a constrained conversation, the target->id and the context are identical. This provides easy identification. - In a constrained conversation, replies SHOULD only be addressed to the target->attributedTo actor. - When receiving a correctly signed `Add` activity, checking that the id of the target is a collection owned by `actor` is slightly different from FEP-400e. This can be accomplished by fetching the Collection object and validating the attributedTo field. diff --git a/src/Lib/Activity.php b/src/Lib/Activity.php index a2da76eb0..8f041a3a8 100644 --- a/src/Lib/Activity.php +++ b/src/Lib/Activity.php @@ -4989,7 +4989,6 @@ class Activity public static function addToCollection($channel, $object, $target, $sourceItem = null, $deliver = true) { - btlogger('addtocollection'); if (!isset($channel['xchan_hash'])) { $channel = Channel::from_hash($channel['channel_hash']); } @@ -5006,7 +5005,7 @@ class Activity ->setReplyto(z_root() . '/channel/' . $channel['channel_address']) ->setTgtType('Collection') ->setTarget([ - 'id' => $target, + 'id' => str_replace('/item/','/conversation/', $target), 'type' => 'Collection', 'attributedTo' => z_root() . '/channel/' . $channel['channel_address'] ] @@ -5043,7 +5042,7 @@ class Activity ->setReplyto(z_root() . '/channel/' . $channel['channel_address']) ->setTgtType('Collection') ->setTarget([ - 'id' => $target, + 'id' => str_replace('/item/','/conversation/', $target), 'type' => 'Collection', 'attributedTo' => z_root() . '/channel/' . $channel['channel_address'] ]