-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Add UserConfigChangedEvent to fire whenever a user config value is changed #42039
base: master
Are you sure you want to change the base?
Conversation
akhil1508
commented
Dec 5, 2023
- For Can we fire UserChangedEvent when setUserValue method is used? #41938
|
||
private function triggerUserValueChange($userId, $appId, $key, $value, $oldValue = null) { | ||
if (\OC::$server instanceof \OCP\IServerContainer) { | ||
$dispatcher = \OC::$server->get(IEventDispatcher::class); |
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.
Cannot use DI for this as it is used in base.php
over here
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.
Is that the right link? The Allconfig constructor does not call setUserValue.
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.
@come-nc I believe I meant to say:
AllConfig
is instantiated inbase.php
asnew \OC\AllConfig(new \OC\SystemConfig(self::$config))
- If I add
IEventListener $eventListener
in the constructor for DI in this class (the usual way), it could be problematic. I remember it causing errors when I first wrote this code, but maybe I should re-test? 🤔
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.
Yes please, the event listener is available early so I would be surprised if this is called even earlier. Maybe for login time 🤔
If some value change call do not trigger the event we need to document that.
037ad05
to
b040664
Compare
Hey @akhil1508 |
|
||
private function triggerUserValueChange($userId, $appId, $key, $value, $oldValue = null) { | ||
if (\OC::$server instanceof \OCP\IServerContainer) { | ||
$dispatcher = \OC::$server->get(IEventDispatcher::class); |
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.
Is that the right link? The Allconfig constructor does not call setUserValue.
0b331d0
to
57d68a3
Compare
Signed-off-by: Akhil <akhil@e.email>
Signed-off-by: Akhil <akhil@e.email>
Signed-off-by: Akhil <akhil@e.email>
57d68a3
to
3040493
Compare