Merge pull request #39991 from nextcloud/backport/39770/stable26

[stable26] fix: always use display name from correct backend
This commit is contained in:
max-nextcloud 2023-09-06 13:26:42 +02:00 committed by GitHub
commit dc73199e2f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -61,6 +61,7 @@ use OCP\L10N\IFactory;
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;
@ -800,6 +801,10 @@ class AccountManager implements IAccountManager {
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;
}