From f61cb2d4f67ae4418c0753393196588b2b0402b4 Mon Sep 17 00:00:00 2001 From: tsmethurst Date: Sun, 23 Oct 2022 15:18:34 +0200 Subject: [PATCH] [PLUGIN][ActivityPub] Check more thoroughly for note 'title' --- plugins/ActivityPub/Util/Model/Note.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/plugins/ActivityPub/Util/Model/Note.php b/plugins/ActivityPub/Util/Model/Note.php index d007ad1fc1..b818b5a753 100644 --- a/plugins/ActivityPub/Util/Model/Note.php +++ b/plugins/ActivityPub/Util/Model/Note.php @@ -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 = [ 'is_local' => false, '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(), 'url' => $type_note->get('url') ?? $type_note->get('id'), 'actor_id' => $actor_id,