Merge pull request #15020 from nextcloud/bugfix/noid/fix-too-many-event-triggers
Bugfix/noid/fix too many event triggers
This commit is contained in:
commit
ccabc63a09
2 changed files with 6 additions and 7 deletions
|
@ -312,11 +312,6 @@ class UserAvatar extends Avatar {
|
|||
* @throws \OCP\PreConditionNotMetException
|
||||
*/
|
||||
public function userChanged($feature, $oldValue, $newValue) {
|
||||
// We only change the avatar on display name changes
|
||||
if ($feature !== 'displayName') {
|
||||
return;
|
||||
}
|
||||
|
||||
// If the avatar is not generated (so an uploaded image) we skip this
|
||||
if (!$this->folder->fileExists('generated')) {
|
||||
return;
|
||||
|
|
|
@ -426,10 +426,9 @@ class Server extends ServerContainer implements IServerContainer {
|
|||
$userSession->listen('\OC\User', 'logout', function () {
|
||||
\OC_Hook::emit('OC_User', 'logout', array());
|
||||
});
|
||||
$userSession->listen('\OC\User', 'changeUser', function ($user, $feature, $value, $oldValue) use ($dispatcher) {
|
||||
$userSession->listen('\OC\User', 'changeUser', function ($user, $feature, $value, $oldValue) {
|
||||
/** @var $user \OC\User\User */
|
||||
\OC_Hook::emit('OC_User', 'changeUser', array('run' => true, 'user' => $user, 'feature' => $feature, 'value' => $value, 'old_value' => $oldValue));
|
||||
$dispatcher->dispatch('OCP\IUser::changeUser', new GenericEvent($user, ['feature' => $feature, 'oldValue' => $oldValue, 'value' => $value]));
|
||||
});
|
||||
return $userSession;
|
||||
});
|
||||
|
@ -1257,6 +1256,11 @@ class Server extends ServerContainer implements IServerContainer {
|
|||
$oldValue = $e->getArgument('oldValue');
|
||||
$value = $e->getArgument('value');
|
||||
|
||||
// We only change the avatar on display name changes
|
||||
if ($feature !== 'displayName') {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
$avatar = $manager->getAvatar($user->getUID());
|
||||
$avatar->userChanged($feature, $oldValue, $value);
|
||||
|
|
Loading…
Reference in a new issue