[PLUGIN][ActivityPub][Test] Activity: Create Page

Fixed a couple of bugs
This commit is contained in:
2022-03-19 22:21:15 +00:00
parent 6955872e05
commit 2f7fdf6ee4
9 changed files with 150 additions and 94 deletions

View File

@@ -143,9 +143,9 @@ class Note extends Model
}
// Figure the locale of the note when possible
$locale = null;
if (\array_key_exists('@language', $type_note->get('@context'))) {
$locale = $type_note->get('@context')['@language'];
$locale = array_column($type_note->get('@context'), '@language');
if ($locale !== []) {
$locale = $locale[0];
if ($locale === 'und') {
$locale = null;
}
@@ -155,7 +155,7 @@ class Note extends Model
'is_local' => false,
'created' => new DateTime($type_note->get('published') ?? 'now'),
'title' => $type_note->get('name') ?? null,
'language_id' => $type_note->get('contentLang') ?? null,
'language_id' => \is_null($locale) ? null : Language::getByLocale($locale)->getId(),
'url' => $type_note->get('url') ?? $type_note->get('id'),
'actor_id' => $actor_id,
'reply_to' => $reply_to = $handleInReplyTo($type_note),
@@ -167,13 +167,6 @@ class Note extends Model
'source' => $source,
];
// Language
if (!\is_null($map['language_id'])) {
$map['language_id'] = Language::getByLocale($map['language_id'])->getId();
} else {
$map['language_id'] = null;
}
// Scope
if (\in_array('https://www.w3.org/ns/activitystreams#Public', $to)) {
// Public: Visible for all, shown in public feeds