revolutionar: change updates might even sent the new value (optional)

This commit is contained in:
Arthur Schiwon 2016-02-09 18:37:41 +01:00
parent d19c47a381
commit 03d0fb4e3f
2 changed files with 7 additions and 7 deletions

View File

@ -244,9 +244,9 @@ class Server extends ServerContainer implements IServerContainer {
$userSession->listen('\OC\User', 'logout', function () { $userSession->listen('\OC\User', 'logout', function () {
\OC_Hook::emit('OC_User', 'logout', array()); \OC_Hook::emit('OC_User', 'logout', array());
}); });
$userSession->listen('\OC\User', 'changeUser', function ($user, $feature) { $userSession->listen('\OC\User', 'changeUser', function ($user, $feature, $value) {
/** @var $user \OC\User\User */ /** @var $user \OC\User\User */
\OC_Hook::emit('OC_User', 'changeUser', array('run' => true, 'user' => $user, 'feature' => $feature)); \OC_Hook::emit('OC_User', 'changeUser', array('run' => true, 'user' => $user, 'feature' => $feature, 'value' => $value));
}); });
return $userSession; return $userSession;
}); });

View File

@ -141,7 +141,7 @@ class User implements IUser {
$result = $this->backend->setDisplayName($this->uid, $displayName); $result = $this->backend->setDisplayName($this->uid, $displayName);
if ($result) { if ($result) {
$this->displayName = $displayName; $this->displayName = $displayName;
$this->triggerChange('displayName'); $this->triggerChange('displayName', $displayName);
} }
return $result !== false; return $result !== false;
} else { } else {
@ -162,7 +162,7 @@ class User implements IUser {
} else { } else {
$this->config->setUserValue($this->uid, 'settings', 'email', $mailAddress); $this->config->setUserValue($this->uid, 'settings', 'email', $mailAddress);
} }
$this->triggerChange('eMailAddress'); $this->triggerChange('eMailAddress', $mailAddress);
} }
/** /**
@ -366,7 +366,7 @@ class User implements IUser {
$quota = OC_Helper::humanFileSize($quota); $quota = OC_Helper::humanFileSize($quota);
} }
$this->config->setUserValue($this->uid, 'files', 'quota', $quota); $this->config->setUserValue($this->uid, 'files', 'quota', $quota);
$this->triggerChange('quota'); $this->triggerChange('quota', $quota);
} }
/** /**
@ -417,9 +417,9 @@ class User implements IUser {
return $url; return $url;
} }
public function triggerChange($feature) { public function triggerChange($feature, $value = null) {
if ($this->emitter) { if ($this->emitter) {
$this->emitter->emit('\OC\User', 'changeUser', array($this, $feature)); $this->emitter->emit('\OC\User', 'changeUser', array($this, $feature, $value));
} }
} }