mirror of
https://github.com/nextcloud/server.git
synced 2026-06-10 17:23:59 -04:00
fix(ldap): avatar is not being fetched
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
This commit is contained in:
parent
7575e870ca
commit
1f748ded7e
2 changed files with 20 additions and 3 deletions
|
|
@ -714,7 +714,7 @@ class User {
|
|||
// use the checksum before modifications
|
||||
$checksum = md5($this->image->data());
|
||||
|
||||
if ($checksum === $this->config->getUserValue($this->uid, 'user_ldap', 'lastAvatarChecksum', '')) {
|
||||
if ($checksum === $this->config->getUserValue($this->uid, 'user_ldap', 'lastAvatarChecksum', '') && $this->avatarExists()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -728,6 +728,15 @@ class User {
|
|||
return $isSet;
|
||||
}
|
||||
|
||||
private function avatarExists(): bool {
|
||||
try {
|
||||
$currentAvatar = $this->avatarManager->getAvatar($this->uid);
|
||||
return $currentAvatar->exists() && $currentAvatar->isCustomAvatar();
|
||||
} catch (\Exception $e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief sets an image as Nextcloud avatar
|
||||
* @return bool
|
||||
|
|
|
|||
|
|
@ -585,9 +585,17 @@ class UserTest extends \Test\TestCase {
|
|||
$avatar = $this->createMock(IAvatar::class);
|
||||
$avatar->expects($this->never())
|
||||
->method('set');
|
||||
$avatar->expects($this->any())
|
||||
->method('exists')
|
||||
->willReturn(true);
|
||||
$avatar->expects($this->any())
|
||||
->method('isCustomAvatar')
|
||||
->willReturn(true);
|
||||
|
||||
$this->avatarManager->expects($this->never())
|
||||
->method('getAvatar');
|
||||
$this->avatarManager->expects($this->any())
|
||||
->method('getAvatar')
|
||||
->with($this->uid)
|
||||
->willReturn($avatar);
|
||||
|
||||
$this->connection->expects($this->any())
|
||||
->method('resolveRule')
|
||||
|
|
|
|||
Loading…
Reference in a new issue