forked from GNUsocial/gnu-social
[ActivityPub][Model][Activity] Translate including objects
This commit is contained in:
@@ -17,7 +17,7 @@ use Plugin\ActivityPub\Entity\ActivitypubActivity;
|
||||
|
||||
abstract class AS2ToEntity
|
||||
{
|
||||
public static function activity_stream_two_verb_to_gs_verb($verb)
|
||||
public static function activity_stream_two_verb_to_gs_verb(string $verb): string
|
||||
{
|
||||
return match ($verb) {
|
||||
'Create' => 'create',
|
||||
@@ -25,7 +25,7 @@ abstract class AS2ToEntity
|
||||
};
|
||||
}
|
||||
|
||||
public static function activity_stream_two_object_type_to_gs_table($object)
|
||||
public static function activity_stream_two_object_type_to_gs_table(string $object): string
|
||||
{
|
||||
return match ($object) {
|
||||
'Note' => 'note',
|
||||
|
@@ -32,9 +32,9 @@ class ActivityToType
|
||||
'id' => Router::url('activity_view', ['id' => $activity->getId()], Router::ABSOLUTE_URL),
|
||||
'published' => $activity->getCreated()->format(DateTimeInterface::RFC3339),
|
||||
'actor' => $activity->getActor()->getUri(Router::ABSOLUTE_URL),
|
||||
//'to' => $to,
|
||||
//'cc' => $cc,
|
||||
'object' => $activity->getObject()->getUrl(),
|
||||
'to' => ['https://www.w3.org/ns/activitystreams#Public'], // TODO: implement proper scope address
|
||||
'cc' => ['https://www.w3.org/ns/activitystreams#Public'],
|
||||
'object' => EntityToType::translate($activity->getObject()),
|
||||
];
|
||||
return Type::create($attr);
|
||||
}
|
||||
|
@@ -22,9 +22,9 @@ class NoteToType
|
||||
'id' => Router::url('note_view', ['id' => $note->getId()], Router::ABSOLUTE_URL),
|
||||
'published' => $note->getCreated()->format(DateTimeInterface::RFC3339),
|
||||
'attributedTo' => $note->getActor()->getUri(Router::ABSOLUTE_URL),
|
||||
//'to' => $to,
|
||||
//'cc' => $cc,
|
||||
'content' => json_encode($note->getRendered()),
|
||||
'to' => ['https://www.w3.org/ns/activitystreams#Public'], // TODO: implement proper scope address
|
||||
'cc' => ['https://www.w3.org/ns/activitystreams#Public'],
|
||||
'content' => $note->getRendered(),
|
||||
//'tag' => $tags
|
||||
];
|
||||
return Type::create(type: 'Note', attributes: $attr);
|
||||
|
Reference in New Issue
Block a user