Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2019-04-11 13:50:15 +0300
committerGitHub <noreply@github.com>2019-04-11 13:50:15 +0300
commit3308c4092269b39c5038fc61075a61302a28a79c (patch)
tree1d47b607d16da5f1b26d825a1fbae60d00e8ad34
parentccabc63a09ee78913db682ac59bfba5512ace442 (diff)
parentc1e6a5965e517acdff9b2c72cf9dd0febdf801f5 (diff)
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.php5
-rw-r--r--tests/lib/Util/User/Dummy.php1
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) {