Browse Source

Merge pull request #11360 from nextcloud/bugfix/11359/fix-avatar-without-php-intl

fix(avatar): Fix avatars without PHP intl module
pull/11368/head
Joas Schilling 2 years ago
committed by GitHub
parent
commit
29f0d44641
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      lib/Service/AvatarService.php

6
lib/Service/AvatarService.php

@ -224,7 +224,7 @@ class AvatarService {
}
}
}
if ($this->emojiHelper->isValidSingleEmoji(mb_substr($room->getName(), 0, 1))) {
if ($this->emojiHelper->doesPlatformSupportEmoji() && $this->emojiHelper->isValidSingleEmoji(mb_substr($room->getName(), 0, 1))) {
return new InMemoryFile(
$token,
$this->getEmojiAvatar(
@ -271,7 +271,7 @@ class AvatarService {
* @return string
*/
protected function getFirstCombinedEmoji(string $roomName, int $length = 0): string {
if (mb_strlen($roomName) === $length) {
if (!$this->emojiHelper->doesPlatformSupportEmoji() || mb_strlen($roomName) === $length) {
return '';
}
@ -344,7 +344,7 @@ class AvatarService {
[$version] = explode('.', $avatarVersion);
return $version;
}
if ($this->emojiHelper->isValidSingleEmoji(mb_substr($room->getName(), 0, 1))) {
if ($this->emojiHelper->doesPlatformSupportEmoji() && $this->emojiHelper->isValidSingleEmoji(mb_substr($room->getName(), 0, 1))) {
return substr(md5($this->getEmojiAvatar($this->getFirstCombinedEmoji($room->getName()), self::THEMING_BRIGHT_BACKGROUND)), 0, 8);
}
$avatarPath = $this->getAvatarPath($room);

Loading…
Cancel
Save