diff options
author | Morris Jobke <hey@morrisjobke.de> | 2019-04-11 12:50:15 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-11 12:50:15 +0200 |
commit | 3308c4092269b39c5038fc61075a61302a28a79c (patch) | |
tree | 1d47b607d16da5f1b26d825a1fbae60d00e8ad34 | |
parent | ccabc63a09ee78913db682ac59bfba5512ace442 (diff) | |
parent | c1e6a5965e517acdff9b2c72cf9dd0febdf801f5 (diff) | |
download | nextcloud-server-3308c4092269b39c5038fc61075a61302a28a79c.tar.gz nextcloud-server-3308c4092269b39c5038fc61075a61302a28a79c.zip |
Merge pull request #14967 from nextcloud/lib-private-user-trigger-pass-old
Do not issue update command if nothing has changed in user values
-rw-r--r-- | lib/private/User/User.php | 5 | ||||
-rw-r--r-- | tests/lib/Util/User/Dummy.php | 1 |
2 files changed, 4 insertions, 2 deletions
diff --git a/lib/private/User/User.php b/lib/private/User/User.php index 48c913db2a9..12af787a5a6 100644 --- a/lib/private/User/User.php +++ b/lib/private/User/User.php @@ -138,11 +138,12 @@ class User implements IUser { */ public function setDisplayName($displayName) { $displayName = trim($displayName); - if ($this->backend->implementsActions(Backend::SET_DISPLAYNAME) && !empty($displayName)) { + $oldDisplayName = $this->getDisplayName(); + if ($this->backend->implementsActions(Backend::SET_DISPLAYNAME) && !empty($displayName) && $displayName !== $oldDisplayName) { $result = $this->backend->setDisplayName($this->uid, $displayName); if ($result) { $this->displayName = $displayName; - $this->triggerChange('displayName', $displayName); + $this->triggerChange('displayName', $displayName, $oldDisplayName); } return $result !== false; } diff --git a/tests/lib/Util/User/Dummy.php b/tests/lib/Util/User/Dummy.php index e77902d6f4e..3db519cedfc 100644 --- a/tests/lib/Util/User/Dummy.php +++ b/tests/lib/Util/User/Dummy.php @@ -164,6 +164,7 @@ class Dummy extends Backend implements \OCP\IUserBackend { public function setDisplayName($uid, $displayName) { $this->displayNames[$uid] = $displayName; + return true; } public function getDisplayName($uid) { |