Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@aldeed
Copy link
Contributor

@aldeed aldeed commented Jan 27, 2020

Impact: minor
Type: feature

Issue

The "users" collection is the domain of the identity service, which is no longer part of the API in 3.0. But it is still being used in several places in API code.

Solution

I've removed most uses of the "users" collection where possible. For a couple mutations in which the identity service currently calls the API, I've moved the users-specific things to live in the "authentication" plugin, which is also specific to the default identity service.

Big picture, this allows you to swap out the Reaction Identity service for some other compatible identity service by creating your own custom plugin to replace the default "authentication" plugin. (In theory. We haven't yet tested any in particular.)

Breaking changes

Because we have no other solution ready, we've removed the sending of emails to "admins" when a new order comes in. Issue #6055 is tracking re-implementation of this in a better way.

addAccountEmailRecord and removeAccountEmailRecord still modify the Account emails list but no longer modify the User emails list. Changing User email list can be implemented on Reaction Identity if needed.

Testing

Verify that the affected mutations/flows work.

  • Email verification doesn't currently work anyway, so can't test that one yet
  • Test reset password by clicking the button from the login screen
  • Verify addAccountEmailRecord and removeAccountEmailRecord GQL mutations still modify the Account emails list properly.

aldeed added 12 commits January 26, 2020 19:32
"users" is the domain of the identity service only and
should not be altered by the API

Signed-off-by: Eric Dobbertin <[email protected]>
"users" is the domain of the identity service only and
should not be altered by the API

Signed-off-by: Eric Dobbertin <[email protected]>
Signed-off-by: Eric Dobbertin <[email protected]>
Signed-off-by: Eric Dobbertin <[email protected]>
to afterAccountUpdate

Signed-off-by: Eric Dobbertin <[email protected]>
that is no longer needed

Signed-off-by: Eric Dobbertin <[email protected]>
Will reimplement in the near future

Signed-off-by: Eric Dobbertin <[email protected]>
Signed-off-by: Eric Dobbertin <[email protected]>
for email mutations

Signed-off-by: Eric Dobbertin <[email protected]>
@aldeed aldeed marked this pull request as ready for review January 27, 2020 18:11
@aldeed aldeed requested a review from kieckhafer January 27, 2020 18:11
Copy link
Member

@kieckhafer kieckhafer left a comment

Choose a reason for hiding this comment

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

I'm seeing an odd error message when using the addAccountEmailRecord and removeAccountEmailRecord email mutations.

When I addAccountEmailRecord, the email gets added to my account, however I get an error message that says "No unverified email found".

The same thing happens when I removeAccountEmailRecord, the email is removed, but I get the same error message.

When checking in the collection, verified = false, so this error message doesn't seem to make sense to be thrown here.

In addition, when I add an email, the new email gets a provides: default added onto the object... in fact every new email I add has provides:default attached to it, so If I add 10 emails, I have 10 emails that all provides: default

Robo_3T_-_1_3

I'd expect only one email address to have provides: default attached to it, and I would also expect that to be the email I signed up with, not the newly added one, unless I explicitly changed my default.

There is confusion here about verifying for users vs. account.
Will add proper account email verification in the future.

Signed-off-by: Eric Dobbertin <[email protected]>
@aldeed
Copy link
Contributor Author

aldeed commented Jan 28, 2020

@kieckhafer Regarding provides:default, I don't think I changed that and I wasn't sure what made sense there.

How would you propose that we handle it? Do you think we should just add them without any provides value, and then maybe make a different mutation for setDefaultAccountEmail, which could be used to switch which one is default?

What about the case where there isn't already a default one and I call addAccountEmailRecord? Should it then be assumed to be default? Or make them explicitly call setDefaultAccountEmail after adding it?

Maybe we should prevent removal of the default in the first place? You have to make another one default before removing that one?

I fixed the "No unverified email found" error by just removing the email validation calls. Those were looking at "users" whereas this is doing "accounts". We can add a validation flow for account emails in a separate PR later.

@kieckhafer
Copy link
Member

kieckhafer commented Jan 29, 2020

@aldeed I think you've mentioned a combo of what's probably the best flow here.

  1. Ideally, when you sign up with your email address, that address is set to provides: default
  2. When you add a new email, if there is already an email that provides default, then the new one doesn't get this field. If there is not already an email that provides: default, then set it for this new email
  3. You cannot delete the default email. If you want to delete your email address, it needs to be the non-default one, or you need to make another one default first
  4. There probably should be a new setAccountDefaultEmail mutation to do this

I created a PR (into your feat-remove-users-collection branch) which takes care of #'s 2, 3, and 4: #6062

I think this PR will be good to go once #6062 is merged into it, so if you want to take a look at my work there, merge it in here if it looks good, then this one should be mergeable.

@kieckhafer
Copy link
Member

Approved, pending getting the changes from #6062 merged into this branch.

@aldeed aldeed merged commit 5d47cae into release-3.0.0 Jan 30, 2020
@aldeed aldeed deleted the feat-remove-users-collection branch January 30, 2020 00:45
@kieckhafer kieckhafer mentioned this pull request Feb 4, 2020
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.

3 participants