Skip to content

Don't call IEnumerable<IUserEventHandler> from UserDisplayDriver #17756

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hishamco
Copy link
Member

@hishamco hishamco commented Apr 7, 2025

Fixes #17072

@hishamco hishamco requested a review from MikeAlhayek April 7, 2025 07:43
@MikeAlhayek
Copy link
Member

I don't think this is a valid approach and should be tested.

Currently users are able to enable or disable users via the handler. So you can implement the handler, the enable or disable the user. With the proposed approach these events are fired after the user is updated which ignores the handlers logic.

What I think should happen here is that we should move the function to enable/disable user outside the Form edit request similar to the approach I did for confirming email in PR #17684

Moving the disable/enable process as part of the Actions button will allow us to properly call the handlers outside the process of updating the data form.

@hishamco
Copy link
Member Author

hishamco commented Apr 8, 2025

With the proposed approach these events are fired after the user is updated which ignores the handlers logic.

What's the wrong with that while enabling / disabling the user should trigger updating event

@MikeAlhayek
Copy link
Member

The ToggleStatus action in the controller will update the User object and call the UserStore.Update "which will trigger the updating and Updated events. This will also normalize the process

@hishamco
Copy link
Member Author

hishamco commented Apr 8, 2025

The current approach will open the possibility to listen to the event outside the OC without accessing the control

@MikeAlhayek
Copy link
Member

Yes but the proposed will not work. Did you test it out or you assumed the code is good?

@hishamco
Copy link
Member Author

hishamco commented Apr 8, 2025

It works fine after disabling UserDisabledEventHandler which makes the app enter an infinite loop. I'm not sure why you are regenerating the user stamp here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IEnumerable<IUserEventHandler> should not be called by UserDisplayDriver
2 participants