Skip to content

Commit

Permalink
Merge pull request #39992 from nextcloud/backport/39770/stable25
Browse files Browse the repository at this point in the history
[stable25] fix: always use display name from correct backend
  • Loading branch information
blizzz authored Oct 9, 2023
2 parents cddcba4 + 40056c8 commit 8fa780b
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 @@ -61,6 +61,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 Symfony\Component\EventDispatcher\EventDispatcherInterface;
Expand Down Expand Up @@ -791,6 +792,10 @@ public function getAccount(IUser $user): IAccount {
return $this->internalCache->get($user->getUID());
}
$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 8fa780b

Please sign in to comment.