summaryrefslogtreecommitdiffstats
path: root/lib/private/Accounts/AccountManager.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/Accounts/AccountManager.php')
-rw-r--r--lib/private/Accounts/AccountManager.php20
1 files changed, 15 insertions, 5 deletions
diff --git a/lib/private/Accounts/AccountManager.php b/lib/private/Accounts/AccountManager.php
index 6496a521326..8c7cd010de1 100644
--- a/lib/private/Accounts/AccountManager.php
+++ b/lib/private/Accounts/AccountManager.php
@@ -23,6 +23,7 @@
namespace OC\Accounts;
+use OCP\IConfig;
use OCP\IDBConnection;
use OCP\IUser;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
@@ -62,6 +63,9 @@ class AccountManager {
/** @var EventDispatcherInterface */
private $eventDispatcher;
+ /** @var IConfig */
+ private $config;
+
/**
* AccountManager constructor.
*
@@ -81,16 +85,22 @@ class AccountManager {
*/
public function updateUser(IUser $user, $data) {
$userData = $this->getUser($user);
+ $updated = true;
if (empty($userData)) {
$this->insertNewUser($user, $data);
- } else {
+ } elseif ($userData !== $data) {
$this->updateExistingUser($user, $data);
+ } else {
+ // nothing needs to be done if new and old data set are the same
+ $updated = false;
}
- $this->eventDispatcher->dispatch(
- 'OC\AccountManager::userUpdated',
- new GenericEvent($user)
- );
+ if ($updated) {
+ $this->eventDispatcher->dispatch(
+ 'OC\AccountManager::userUpdated',
+ new GenericEvent($user)
+ );
+ }
}
/**