[FreeNetwork][ActivityPub] Sometimes remote Actors report empty full names in not very explicit manners

This commit is contained in:
Diogo Peralta Cordeiro 2021-12-12 06:32:17 +00:00
parent a81ac673ac
commit 1d09a02ad6
Signed by: diogo
GPG Key ID: 18D2D35001FBFAB0
3 changed files with 4 additions and 4 deletions

View File

@ -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],

View File

@ -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,

View File

@ -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(),
];
}