summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2019-09-04 13:36:08 +0200
committerArthur Schiwon <blizzz@arthur-schiwon.de>2019-09-04 13:46:25 +0200
commit3ce5d4e5450607b42da73f5c45a6fcd516fd9462 (patch)
tree6a10380f69fd2d107b45c1b99c15305bbff83a42 /lib
parent0e19e55e242af3e665035f5928d293ed9addc4ed (diff)
downloadnextcloud-server-3ce5d4e5450607b42da73f5c45a6fcd516fd9462.tar.gz
nextcloud-server-3ce5d4e5450607b42da73f5c45a6fcd516fd9462.zip
reduce adressbook change events and handling
... from four to one on avatar updates Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Avatar/UserAvatar.php8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/private/Avatar/UserAvatar.php b/lib/private/Avatar/UserAvatar.php
index 2db65634e8c..f96ec93d5d0 100644
--- a/lib/private/Avatar/UserAvatar.php
+++ b/lib/private/Avatar/UserAvatar.php
@@ -97,7 +97,7 @@ class UserAvatar extends Avatar {
$this->validateAvatar($img);
- $this->remove();
+ $this->remove(true);
$type = $this->getAvatarImageType($img);
$file = $this->folder->newFile('avatar.' . $type);
$file->putContent($data);
@@ -193,7 +193,7 @@ class UserAvatar extends Avatar {
* @throws \OCP\Files\NotPermittedException
* @throws \OCP\PreConditionNotMetException
*/
- public function remove() {
+ public function remove(bool $silent = false) {
$avatars = $this->folder->getDirectoryListing();
$this->config->setUserValue($this->user->getUID(), 'avatar', 'version',
@@ -203,7 +203,9 @@ class UserAvatar extends Avatar {
$avatar->delete();
}
$this->config->setUserValue($this->user->getUID(), 'avatar', 'generated', 'true');
- $this->user->triggerChange('avatar', '');
+ if(!$silent) {
+ $this->user->triggerChange('avatar', '');
+ }
}
/**