Don't get the avatar when we don't operate anyway

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2019-04-09 11:23:06 +02:00
parent ec4b1584fe
commit 38f8f7cbf4
No known key found for this signature in database
GPG Key ID: 7076EA9751AACDDA
2 changed files with 5 additions and 5 deletions

View File

@ -312,11 +312,6 @@ class UserAvatar extends Avatar {
* @throws \OCP\PreConditionNotMetException
*/
public function userChanged($feature, $oldValue, $newValue) {
// We only change the avatar on display name changes
if ($feature !== 'displayName') {
return;
}
// If the avatar is not generated (so an uploaded image) we skip this
if (!$this->folder->fileExists('generated')) {
return;

View File

@ -1257,6 +1257,11 @@ class Server extends ServerContainer implements IServerContainer {
$oldValue = $e->getArgument('oldValue');
$value = $e->getArgument('value');
// We only change the avatar on display name changes
if ($feature !== 'displayName') {
return;
}
try {
$avatar = $manager->getAvatar($user->getUID());
$avatar->userChanged($feature, $oldValue, $value);