Skip to content
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

OmniAuthCallbacksController: Eliminiate @user #25010

Merged
merged 2 commits into from Sep 26, 2018
Merged

Conversation

islemaster
Copy link
Contributor

Mentally tracking the state of this @user instance variable while working on this controller has been a small pain point that wasn't much work to eliminate, so here I've removed it and moved us one step away from side effects in these controller functions.

There are two key signature changes here:

void sign_in_user => void sign_in_user(User)
Instead of depending on instance state, this method now signs in whatever user was passed in.

void silent_takeover(User, AuthHash) => User silent_takeover(User, AuthHash)
This method used to sometimes set @user as a side-effect of the silent takeover, causing the takeover target user to be signed in, instead of the OAuth user passed in as the first argument. I've made a small change so that this function now returns one user or the other, and expects the caller to handle the result. Expected calling pattern is now:

user = silent_takeover user, auth_hash

@islemaster islemaster requested review from maddiedierker and ewjordan and removed request for maddiedierker September 25, 2018 18:22
Copy link
Contributor

@maddiedierker maddiedierker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 great clean-up!

@islemaster islemaster merged commit 6f538e9 into staging Sep 26, 2018
@islemaster islemaster deleted the oauth-pure-functions branch September 26, 2018 04:39
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.

None yet

2 participants