[PLUGIN][ActivityPub] Check more thoroughly for note 'title'

This commit is contained in:
tsmethurst 2022-10-23 15:18:34 +02:00
parent 2da614e344
commit f61cb2d4f6

View File

@ -156,10 +156,19 @@ class Note extends Model
} }
} }
// Figure out the title of the note;
// try 'name' first (GS), then 'summary' (Mastodon/GtS/Pleroma)
$title = null;
if ($type_note->has('name') && !empty($type_note->get('name'))) {
$title = $type_note->get('name');
} else if ($type_note->has('summary') && !empty($type_note->get('summary'))) {
$title = $type_note->get('summary');
}
$map = [ $map = [
'is_local' => false, 'is_local' => false,
'created' => new DateTime($type_note->get('published') ?? 'now'), 'created' => new DateTime($type_note->get('published') ?? 'now'),
'title' => $type_note->get('name') ?? null, 'title' => $title,
'language_id' => \is_null($locale) ? null : Language::getByLocale($locale)->getId(), 'language_id' => \is_null($locale) ? null : Language::getByLocale($locale)->getId(),
'url' => $type_note->get('url') ?? $type_note->get('id'), 'url' => $type_note->get('url') ?? $type_note->get('id'),
'actor_id' => $actor_id, 'actor_id' => $actor_id,