Skip to content

Commit

Permalink
Merge pull request #39770 from nextcloud/fix/always-use-displayname-f…
Browse files Browse the repository at this point in the history
…rom-correct-backend

fix: always use display name from correct backend
  • Loading branch information
max-nextcloud committed Aug 17, 2023
2 parents a98748e + 99a4a9c commit 4b7aa65
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/private/Accounts/AccountManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
use OCP\Mail\IMailer;
use OCP\Security\ICrypto;
use OCP\Security\VerificationToken\IVerificationToken;
use OCP\User\Backend\IGetDisplayNameBackend;
use OCP\Util;
use Psr\Log\LoggerInterface;
use function array_flip;
Expand Down Expand Up @@ -744,6 +745,10 @@ public function getAccount(IUser $user): IAccount {
return $cached;
}
$account = $this->parseAccountData($user, $this->getUser($user));
if ($user->getBackend() instanceof IGetDisplayNameBackend) {
$property = $account->getProperty(self::PROPERTY_DISPLAYNAME);
$account->setProperty(self::PROPERTY_DISPLAYNAME, $user->getDisplayName(), $property->getScope(), $property->getVerified());
}
$this->internalCache->set($user->getUID(), $account);
return $account;
}
Expand Down

0 comments on commit 4b7aa65

Please sign in to comment.