[PLUGIN][ActivityPub][Model][Activity] toJson: When in activity context, use object's context if available
This commit is contained in:
parent
23e88b30a6
commit
6955872e05
@ -170,8 +170,8 @@ class Activity extends Model
|
|||||||
'actor' => $object->getActor()->getUri(Router::ABSOLUTE_URL),
|
'actor' => $object->getActor()->getUri(Router::ABSOLUTE_URL),
|
||||||
];
|
];
|
||||||
|
|
||||||
$attr['to'] = [];
|
$attr['to'] = ['https://www.w3.org/ns/activitystreams#Public'];
|
||||||
$attr['cc'] = ['https://www.w3.org/ns/activitystreams#Public'];
|
$attr['cc'] = [];
|
||||||
foreach ($object->getAttentionTargets() as $target) {
|
foreach ($object->getAttentionTargets() as $target) {
|
||||||
$attr['cc'][] = $target->getUri();
|
$attr['cc'][] = $target->getUri();
|
||||||
}
|
}
|
||||||
@ -191,6 +191,7 @@ class Activity extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!\is_string($attr['object'])) {
|
if (!\is_string($attr['object'])) {
|
||||||
|
$attr['@context'] = $attr['object']->get('@context');
|
||||||
$attr['object']->set('@context', null);
|
$attr['object']->set('@context', null);
|
||||||
}
|
}
|
||||||
$type = self::jsonToType($attr);
|
$type = self::jsonToType($attr);
|
||||||
|
Loading…
Reference in New Issue
Block a user