-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Bugfix/noid/fix too many event triggers #15020
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -426,10 +426,9 @@ public function __construct($webRoot, \OC\Config $config) { | |||||||||||
| $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])); | ||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why this?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because the very same event is dispatched already in the server/lib/private/User/User.php Lines 466 to 470 in 01b4db6
Right before the legacy hook is emitted, which will call this place and trigger the event again. |
||||||||||||
| }); | ||||||||||||
| return $userSession; | ||||||||||||
| }); | ||||||||||||
|
|
@@ -1257,6 +1256,11 @@ private function connectDispatcher() { | |||||||||||
| $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); | ||||||||||||
|
|
||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extracted to #15022 so we can merge this quickly for 16