[FreeNetwork][ActivityPub] Sometimes remote Actors report empty full names in not very explicit manners
This commit is contained in:
parent
a81ac673ac
commit
1d09a02ad6
@ -373,7 +373,7 @@ class FreeNetwork extends Component
|
|||||||
}
|
}
|
||||||
assert($actor instanceof Actor);
|
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] = [
|
$matches[$pos] = [
|
||||||
'mentioned' => [$actor],
|
'mentioned' => [$actor],
|
||||||
|
@ -77,7 +77,7 @@ class Actor extends Model
|
|||||||
// Actor
|
// Actor
|
||||||
$actor_map = [
|
$actor_map = [
|
||||||
'nickname' => $person->get('preferredUsername'),
|
'nickname' => $person->get('preferredUsername'),
|
||||||
'fullname' => $person->get('name'),
|
'fullname' => !empty($person->get('name')) ? $person->get('name') : null,
|
||||||
'created' => new DateTime($person->get('published') ?? 'now'),
|
'created' => new DateTime($person->get('published') ?? 'now'),
|
||||||
'bio' => $person->has('summary') ? mb_substr(Security::sanitize($person->get('summary')), 0, 1000) : null,
|
'bio' => $person->has('summary') ? mb_substr(Security::sanitize($person->get('summary')), 0, 1000) : null,
|
||||||
'is_local' => false,
|
'is_local' => false,
|
||||||
|
@ -316,7 +316,7 @@ abstract class Formatting
|
|||||||
'text' => $match[0],
|
'text' => $match[0],
|
||||||
'position' => $match[1],
|
'position' => $match[1],
|
||||||
'length' => mb_strlen($match[0]),
|
'length' => mb_strlen($match[0]),
|
||||||
'title' => $mentioned->getFullname(),
|
'title' => $mentioned->getFullname() ?? $mentioned->getNickname(),
|
||||||
'url' => $url,
|
'url' => $url,
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -370,7 +370,7 @@ abstract class Formatting
|
|||||||
'position' => $group_match[1],
|
'position' => $group_match[1],
|
||||||
'length' => mb_strlen($group_match[0]),
|
'length' => mb_strlen($group_match[0]),
|
||||||
'url' => $group->getUri(),
|
'url' => $group->getUri(),
|
||||||
'title' => $group->getFullname(),
|
'title' => $group->getFullname() ?? $group->getNickname(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user