diff options
author | Morris Jobke <hey@morrisjobke.de> | 2019-04-11 11:18:41 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-11 11:18:41 +0200 |
commit | 757a841d14a7a8286f2d88acfc82c22c5551e5f9 (patch) | |
tree | 64f41ec8e8dcc86783d1ca7ad8786b895373474f /lib | |
parent | ef06c3f1d27a2ee3f754f2f6db578c0cc3822c25 (diff) | |
parent | f420647add0f5ffc917301335d82d951a1df502e (diff) | |
download | nextcloud-server-757a841d14a7a8286f2d88acfc82c22c5551e5f9.tar.gz nextcloud-server-757a841d14a7a8286f2d88acfc82c22c5551e5f9.zip |
Merge pull request #15052 from nextcloud/fix/noid/pass-oldvalue
Pass old value to user triggerChange hook & do not update unchanged attributes
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/User/User.php | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/private/User/User.php b/lib/private/User/User.php index 17fa022b1b7..48c913db2a9 100644 --- a/lib/private/User/User.php +++ b/lib/private/User/User.php @@ -145,9 +145,8 @@ class User implements IUser { $this->triggerChange('displayName', $displayName); } return $result !== false; - } else { - return false; } + return false; } /** @@ -159,12 +158,12 @@ class User implements IUser { */ public function setEMailAddress($mailAddress) { $oldMailAddress = $this->getEMailAddress(); - if($mailAddress === '') { - $this->config->deleteUserValue($this->uid, 'settings', 'email'); - } else { - $this->config->setUserValue($this->uid, 'settings', 'email', $mailAddress); - } if($oldMailAddress !== $mailAddress) { + if($mailAddress === '') { + $this->config->deleteUserValue($this->uid, 'settings', 'email'); + } else { + $this->config->setUserValue($this->uid, 'settings', 'email', $mailAddress); + } $this->triggerChange('eMailAddress', $mailAddress, $oldMailAddress); } } @@ -365,7 +364,8 @@ class User implements IUser { $oldStatus = $this->isEnabled(); $this->enabled = $enabled; if ($oldStatus !== $this->enabled) { - $this->triggerChange('enabled', $enabled); + // TODO: First change the value, then trigger the event as done for all other properties. + $this->triggerChange('enabled', $enabled, $oldStatus); $this->config->setUserValue($this->uid, 'core', 'enabled', $enabled ? 'true' : 'false'); } } @@ -407,9 +407,9 @@ class User implements IUser { $quota = OC_Helper::computerFileSize($quota); $quota = OC_Helper::humanFileSize($quota); } - $this->config->setUserValue($this->uid, 'files', 'quota', $quota); if($quota !== $oldQuota) { - $this->triggerChange('quota', $quota); + $this->config->setUserValue($this->uid, 'files', 'quota', $quota); + $this->triggerChange('quota', $quota, $oldQuota); } } |