From 6955872e05900cab1595ece23a784d3da1ca7387 Mon Sep 17 00:00:00 2001 From: Diogo Peralta Cordeiro Date: Sat, 19 Mar 2022 22:20:17 +0000 Subject: [PATCH] [PLUGIN][ActivityPub][Model][Activity] toJson: When in activity context, use object's context if available --- plugins/ActivityPub/Util/Model/Activity.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/ActivityPub/Util/Model/Activity.php b/plugins/ActivityPub/Util/Model/Activity.php index 1208dc1ef4..23bcb770b2 100644 --- a/plugins/ActivityPub/Util/Model/Activity.php +++ b/plugins/ActivityPub/Util/Model/Activity.php @@ -170,8 +170,8 @@ class Activity extends Model 'actor' => $object->getActor()->getUri(Router::ABSOLUTE_URL), ]; - $attr['to'] = []; - $attr['cc'] = ['https://www.w3.org/ns/activitystreams#Public']; + $attr['to'] = ['https://www.w3.org/ns/activitystreams#Public']; + $attr['cc'] = []; foreach ($object->getAttentionTargets() as $target) { $attr['cc'][] = $target->getUri(); } @@ -191,6 +191,7 @@ class Activity extends Model } if (!\is_string($attr['object'])) { + $attr['@context'] = $attr['object']->get('@context'); $attr['object']->set('@context', null); } $type = self::jsonToType($attr);