[PLUGIN][ActivityPub] Add mention tags
This commit is contained in:
parent
a005a7bcea
commit
a9c73a8f33
@ -225,15 +225,25 @@ class Note extends Model
|
|||||||
$attr = [
|
$attr = [
|
||||||
'@context' => 'https://www.w3.org/ns/activitystreams',
|
'@context' => 'https://www.w3.org/ns/activitystreams',
|
||||||
'type' => 'Note',
|
'type' => 'Note',
|
||||||
'id' => Router::url('note_view', ['id' => $object->getId()], Router::ABSOLUTE_URL),
|
'id' => $object->getUrl(),
|
||||||
'published' => $object->getCreated()->format(DateTimeInterface::RFC3339),
|
'published' => $object->getCreated()->format(DateTimeInterface::RFC3339),
|
||||||
'attributedTo' => $object->getActor()->getUri(Router::ABSOLUTE_URL),
|
'attributedTo' => $object->getActor()->getUri(Router::ABSOLUTE_URL),
|
||||||
'to' => ['https://www.w3.org/ns/activitystreams#Public'], // TODO: implement proper scope address
|
'to' => ['https://www.w3.org/ns/activitystreams#Public'], // TODO: implement proper scope address
|
||||||
'cc' => ['https://www.w3.org/ns/activitystreams#Public'],
|
'cc' => ['https://www.w3.org/ns/activitystreams#Public'],
|
||||||
'content' => $object->getRendered(),
|
'content' => $object->getRendered(),
|
||||||
'attachment' => [],
|
'attachment' => [],
|
||||||
|
'tag' => [],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// Mentions
|
||||||
|
foreach ($object->getNotificationTargets() as $mention) {
|
||||||
|
$attr['tag'][] = [
|
||||||
|
'type' => 'Mention',
|
||||||
|
'href' => ($href = $mention->getUri()),
|
||||||
|
'name' => '@'.$mention->getNickname().'@'.parse_url($href, PHP_URL_HOST)
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
// Attachments
|
// Attachments
|
||||||
foreach ($object->getAttachments() as $attachment) {
|
foreach ($object->getAttachments() as $attachment) {
|
||||||
$attr['attachment'][] = [
|
$attr['attachment'][] = [
|
||||||
|
Loading…
Reference in New Issue
Block a user