This commit is contained in:
Yuri Kuznetsov
2024-11-16 15:18:52 +02:00
parent 3edb30285c
commit c0a13f79df
+14 -2
View File
@@ -157,8 +157,9 @@ class Avatar extends Image
$color = $this->getColor($user);
$textColor = $this->isDark($color) ? $textColors[0] : $textColors[1];
$avatar = (new InitialAvatar())
->name($user->getName() ?? $user->getUserName() ?? $userId);
$name = $this->getName($user, $userId);
$avatar = (new InitialAvatar())->name($name);
if ($user->getName() && !self::isAllowedLanguage($avatar)) {
$avatar = $avatar->name($user->getUserName() ?? $userId);
@@ -287,4 +288,15 @@ class Avatar extends Image
return [$light, $dark];
}
private function getName(User $user, string $userId): string
{
$name = $user->getName() ?? $user->getUserName() ?? $userId;
if ($user->getUserName() === SystemUser::NAME) {
$name = SystemUser::NAME;
}
return $name;
}
}