[ActivityPub][Postman] Fill To and CC with mentions
This commit is contained in:
parent
48b2c8c04e
commit
1865d2b41e
|
@ -170,7 +170,10 @@ class Activity extends Model
|
|||
'to' => ['https://www.w3.org/ns/activitystreams#Public'], // TODO: implement proper scope address
|
||||
'cc' => ['https://www.w3.org/ns/activitystreams#Public'],
|
||||
];
|
||||
$attr['object'] = $attr['type'] === 'Create' ? self::jsonToType(Model::toJson($object->getObject())) : ActivityPub::getUriByObject($object->getObject());
|
||||
$attr['object'] = ($attr['type'] === 'Create') ? self::jsonToType(Model::toJson($object->getObject())) : ActivityPub::getUriByObject($object->getObject());
|
||||
|
||||
$attr['to'] = array_unique(array_merge($attr['to'], $attr['object']->get('to')));
|
||||
$attr['cc'] = array_unique(array_merge($attr['cc'], $attr['object']->get('cc')));
|
||||
|
||||
$type = self::jsonToType($attr);
|
||||
Event::handle('ActivityPubAddActivityStreamsTwoData', [$type->get('type'), &$type]);
|
||||
|
|
|
@ -233,6 +233,7 @@ class Note extends Model
|
|||
'content' => $object->getRendered(),
|
||||
'attachment' => [],
|
||||
'tag' => [],
|
||||
'directMessage' => false, // // TODO: implement proper scope address
|
||||
];
|
||||
|
||||
// Mentions
|
||||
|
@ -242,6 +243,7 @@ class Note extends Model
|
|||
'href' => ($href = $mention->getUri()),
|
||||
'name' => '@'.$mention->getNickname().'@'.parse_url($href, PHP_URL_HOST)
|
||||
];
|
||||
$attr['cc'][] = $href;
|
||||
}
|
||||
|
||||
// Attachments
|
||||
|
|
Loading…
Reference in New Issue
Block a user