diff options
-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) { |