[PLUGIN][ActivityPub] Improve flexibility of Type layer, accomodate more elaborate understanding of Group Announces after FEP-2100 development
This commit is contained in:
@@ -166,6 +166,7 @@ class Note extends Model
|
||||
'reply_to' => $reply_to = $handleInReplyTo($type_note),
|
||||
'modified' => new DateTime(),
|
||||
'type' => match ($type_note->get('type')) {
|
||||
'Article' => 'article',
|
||||
'Page' => 'page',
|
||||
default => 'note'
|
||||
},
|
||||
@@ -361,7 +362,7 @@ class Note extends Model
|
||||
* @throws InvalidArgumentException
|
||||
* @throws ServerException
|
||||
*/
|
||||
public static function toJson(mixed $object, int $options = \JSON_UNESCAPED_SLASHES): string
|
||||
public static function toType(mixed $object): AbstractObject
|
||||
{
|
||||
if ($object::class !== GSNote::class) {
|
||||
throw new InvalidArgumentException('First argument type must be a Note.');
|
||||
@@ -469,6 +470,6 @@ class Note extends Model
|
||||
|
||||
$type = self::jsonToType($attr);
|
||||
Event::handle('ActivityPubAddActivityStreamsTwoData', [$type->get('type'), &$type]);
|
||||
return $type->toJson($options);
|
||||
return $type;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user