Conversation
When a user logs in with an existing account in Minion we remove the account that was created for the invited user. We update all the group associations to the login from the original invite account.
minion/backend/views/invites.py
Outdated
There was a problem hiding this comment.
I don't think this is an appropriate solution. First of all, the error reporting does not work. You call jsonify to create an error rrsponse but it is never returned. If you have to return it then the contextmanager would have to return a tuple with (error, invitation, user) which does not seem to be the right thing. Context managers were not really intended for this kind of code.
I would prefer to simply see load_invite and validate_invite functions that return an error if the invite is bad.
There was a problem hiding this comment.
Hmmm the nice thing about this contextmanager "hack" is it allows us to do enter and exit. I probably could do decorator @ but i have to re-read both documents which is resource wasteful. I do this initially because I kinda want to move away from the C-like style where we do
user, invitation = func(...)
I think we can do that. I was hoping to find a api-level enter, exit scope. Maybe thats what class api is for :)
Let;s remove context manager then.
…me of invite instead of sending a new id.
Finally got a few hours tonight to finish this! Refactoring went pretty smoothly. Manual testing is time consuming.
This requires mozilla/minion-frontend#140 to be pulled in.