-
Notifications
You must be signed in to change notification settings - Fork 86
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
Added "github" context to users created during github sync #955
Conversation
f254823
to
f410ef9
Compare
The Phoenix docs on contexts seem to indicate that a pluralized form – |
lib/code_corps/account/account.ex
Outdated
%User{} | ||
|> Changeset.change(attrs |> Adapters.User.from_github_user()) | ||
|> Changeset.put_change(:context, "github") | ||
|> Changeset.unique_constraint(:email) |
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.
What happens if the email is nil
? GitHub is not guaranteed to return one.
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.
We already merged in a PR where a user can be inserted without an email, so we should be fine. Really, what's important for us here is the github id, so we can associate this "stub" with an actual user later, when they connect with github.
I don't feel strongly about it one way or another. I can make the quick change |
f410ef9
to
5e6d0ea
Compare
- added Accounts bounded context - added Accounts.create_from_github - added AccountsTest - added user.json github fixture
5e6d0ea
to
46b51a6
Compare
Closes #948
Issues.UserLinker
andIssueComment.UserLinker
ended up needing the exact same change and are quite similar to begin with. Instead of trying to force this into aGithub.Event.Common
module, I figured this is a good opportunity to start aCodeCorps.Account
bounded context, with its first function,Account.create_from_github/1
Account
bounded contextAccount.create_from_github/1
AccountTest
fixtures/github/endpoint/user.json
The context is simply
"github"
since the whole idea is that the user being created originates from github.