diff --git a/components/FreeNetwork/FreeNetwork.php b/components/FreeNetwork/FreeNetwork.php index 6ee07cbac6..0ff9f388ab 100644 --- a/components/FreeNetwork/FreeNetwork.php +++ b/components/FreeNetwork/FreeNetwork.php @@ -373,7 +373,7 @@ class FreeNetwork extends Component } assert($actor instanceof Actor); - $displayName = $actor->getFullname() ?? $actor->getNickname() ?? $target; // TODO: we could do getBestName() or getFullname() here + $displayName = !empty($actor->getFullname()) ? $actor->getFullname() : $actor->getNickname() ?? $target; // TODO: we could do getBestName() or getFullname() here $matches[$pos] = [ 'mentioned' => [$actor], diff --git a/plugins/ActivityPub/Util/Model/Actor.php b/plugins/ActivityPub/Util/Model/Actor.php index f9a30155fd..057710e81e 100644 --- a/plugins/ActivityPub/Util/Model/Actor.php +++ b/plugins/ActivityPub/Util/Model/Actor.php @@ -77,7 +77,7 @@ class Actor extends Model // Actor $actor_map = [ 'nickname' => $person->get('preferredUsername'), - 'fullname' => $person->get('name'), + 'fullname' => !empty($person->get('name')) ? $person->get('name') : null, 'created' => new DateTime($person->get('published') ?? 'now'), 'bio' => $person->has('summary') ? mb_substr(Security::sanitize($person->get('summary')), 0, 1000) : null, 'is_local' => false, diff --git a/src/Util/Formatting.php b/src/Util/Formatting.php index da1a3c02b8..c5a00384de 100644 --- a/src/Util/Formatting.php +++ b/src/Util/Formatting.php @@ -316,7 +316,7 @@ abstract class Formatting 'text' => $match[0], 'position' => $match[1], 'length' => mb_strlen($match[0]), - 'title' => $mentioned->getFullname(), + 'title' => $mentioned->getFullname() ?? $mentioned->getNickname(), 'url' => $url, ]; @@ -370,7 +370,7 @@ abstract class Formatting 'position' => $group_match[1], 'length' => mb_strlen($group_match[0]), 'url' => $group->getUri(), - 'title' => $group->getFullname(), + 'title' => $group->getFullname() ?? $group->getNickname(), ]; }