-
Notifications
You must be signed in to change notification settings - Fork 177
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
Fix user singleton when an argument is passed. #9572
base: main
Are you sure you want to change the base?
Conversation
User::singleton currently always returns the logged in user. If the $username argument is passed, it still returns the logged in user instead of the user requested. This updates the singleton so that it's possible to use it to get references to other users.
@driusan I think this problem might be on 26 as well? can you fix it there if its the case please? it affects projects currently on 26 |
@ridz1208 I think the problem goes back to the beginning of time. What is the reasoning to put this on 26? I found this by trying to write new code. I don't think it affects any existing code since it's always called without an argument. |
@driusan I thought it broke recently, I tried using the singleton for a CBIG feature and realised it only ever returns the current user. I ended up using the factory directly. I figured it's a bugfix it could got to 26 but if its been like that ofrever its fine to just got o main |
I think that's the case for all existing code--anyone who tried using it realized it didn't work and used factory directly. That's why I sent this to main: as far as I can tell it doesn't fix any user-facing bugs since all current code has a workaround, but it makes it possible to use it in new code and is less surprising to anyone who tries to do it. |
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.
I hate it but okai
User::singleton currently always returns the logged in user. If the $username argument is passed, it still returns the logged in user instead of the user requested.
This updates the singleton so that it's possible to use it to get references to other users.