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

Added ResendConfirmation GraphQL method. #35

Merged
merged 16 commits into from
Nov 24, 2019

Conversation

aarona
Copy link
Contributor

@aarona aarona commented Oct 31, 2019

No description provided.

@mcelicalderon
Copy link
Member

mcelicalderon commented Oct 31, 2019

Much better, thanks for fixing your commits. I will review both PRs as soon as I have some free time. Just a note on this one, it also contains the changes to the docs you included in the other PR. This one should ONLY be about the resendConfirmation mutation. No need to close the PRs, they can always be fixed.

@aarona
Copy link
Contributor Author

aarona commented Nov 1, 2019

Ok, got it! Yeah I also noticed that. A throwback from when I did my documentation work on master instead of its own branch. I tried fixing those PRs with a fresh copy from upstream and they didn't seem to work. I shouldn't have that issue again though now that I'm doing things correctly. Thanks for your patience and also thank you for giving me this task. It was fun to do and helped me learn a good position of the gem's code base. Much appreciated!

@aarona
Copy link
Contributor Author

aarona commented Nov 1, 2019

If you notice, I added documentation for the ResendConfirmation method. I saved this file so that only that change is there but I haven't pushed it to my github feature branch. After you review this code, do you want me to commit that change so that only the ResendConfirmation code is effected, or is this PR fine as is?

00dav00 and others added 2 commits November 4, 2019 06:35
@mcelicalderon
Copy link
Member

I merged the #34, you need to resolve conflicts on this branch because of that. I still have to review the resend confirmation mutation, but on the mean time you could cleanup the readme, it should also include docs for the new mutation (just add it to the list as the others)

@aarona aarona closed this Nov 4, 2019
@aarona aarona deleted the resend_confirmation branch November 4, 2019 17:55
@mcelicalderon
Copy link
Member

Why did you close this one? Please don't open another one just because of git conflicts. Fix your branch locally and push to this same branch. you can push force git push -f when you have fixed your branch locally

@aarona aarona reopened this Nov 4, 2019
@aarona
Copy link
Contributor Author

aarona commented Nov 4, 2019

Sorry after I updated my feature branch it looked like the other branch with a bunch of changes and I thought wouldn't want that so I was trying to fix it so it was a clean push. I'll fix this.

@aarona
Copy link
Contributor Author

aarona commented Nov 4, 2019

When I looked at the changes files, it had files that I didn't change (see https://github.com/graphql-devise/graphql_devise/pull/35/files). It looks like I'm trying to add the Issue configuration files but thats from another PR that someone else did.

@aarona
Copy link
Contributor Author

aarona commented Nov 4, 2019

Ok All the code in this PR is exactly what I want to add to the master branch.

Copy link
Member

@mcelicalderon mcelicalderon left a comment

Choose a reason for hiding this comment

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

Looks good! Thanks for the PR. Left some comments, let me know if you have questions.

config/locales/en.yml Show resolved Hide resolved
spec/requests/mutations/resend_confirmation_spec.rb Outdated Show resolved Hide resolved
spec/requests/mutations/resend_confirmation_spec.rb Outdated Show resolved Hide resolved
spec/requests/mutations/resend_confirmation_spec.rb Outdated Show resolved Hide resolved
spec/requests/mutations/resend_confirmation_spec.rb Outdated Show resolved Hide resolved
Copy link
Contributor

@00dav00 00dav00 left a comment

Choose a reason for hiding this comment

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

@aarona could you add test to know what would happen if the email provided belongs to a user that is already confirmed? How devise behaves in this case?

@aarona
Copy link
Contributor Author

aarona commented Nov 6, 2019

Yes, thats a really good idea and I was considering that. I wanted to ask you guys if you had any other scenarios to test for. I'm going to sit down tonight and work on these changes.

config/locales/en.yml Outdated Show resolved Hide resolved
@aarona
Copy link
Contributor Author

aarona commented Nov 13, 2019

Just bumping this PR. I've made the changes you guys had requested.

@mcelicalderon
Copy link
Member

Thanks! I will take a look ASAP

Copy link
Contributor

@00dav00 00dav00 left a comment

Choose a reason for hiding this comment

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

@aarona left a couple comments for you, this is looking good :)

README.md Show resolved Hide resolved
spec/requests/mutations/resend_confirmation_spec.rb Outdated Show resolved Hide resolved
spec/requests/mutations/resend_confirmation_spec.rb Outdated Show resolved Hide resolved
Copy link
Member

@mcelicalderon mcelicalderon left a comment

Choose a reason for hiding this comment

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

Looking great @aarona. Just some small changes to address, PR is getting there.

if resource
yield resource if block_given?

raise_user_error("Email #{I18n.t('errors.messages.already_confirmed')}") if resource.confirmed?
Copy link
Member

Choose a reason for hiding this comment

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

Why interpolate a localized string here? Just put the entire string in the locales file please

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The reason why I did this is because it seemed you wanted to fall back on Devise locales. The errors.message.already_confirmed value is: "was already confirmed, please try signing in". I can make this whole thing as a locale entry but I'll have to put it into the graphql_devise locale. Would you prefer that instead?

Copy link
Member

Choose a reason for hiding this comment

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

yes please, move the entire message to our own locales file. I think the rule for localized messages should be that ANY message we use directly in OUR code, should go in our locales file. Otherwise we depend on the other gems to keep those keys on their locales files, if for any reason a version of those gems changes the messages, it could affect our gem. I'll have to check the rest of the code for the same thing, but for this PR, please make sure any localized message YOU use in the code has an entry in our locales file (the entire message always as some languages might have a completely different way to say something)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes check the /app/views/graphql_devise/mailer/reset_password_instructions.html.erb file because it also relies on Devise's locale file. I can create a seperate PR for that and fix that.

I'll fix mine and update this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually it looks like both mailers do this. I'll create a PR for both later.

spec/requests/mutations/resend_confirmation_spec.rb Outdated Show resolved Hide resolved
spec/requests/mutations/resend_confirmation_spec.rb Outdated Show resolved Hide resolved
Copy link
Member

@mcelicalderon mcelicalderon left a comment

Choose a reason for hiding this comment

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

Looks good @aarona I think the locales thing is the most important one to take care of now, just make sure any message you are using comes from an entry on our locales file. Other small style comments and should be good to merge

spec/requests/mutations/resend_confirmation_spec.rb Outdated Show resolved Hide resolved
if resource
yield resource if block_given?

raise_user_error("Email #{I18n.t('errors.messages.already_confirmed')}") if resource.confirmed?
Copy link
Member

Choose a reason for hiding this comment

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

yes please, move the entire message to our own locales file. I think the rule for localized messages should be that ANY message we use directly in OUR code, should go in our locales file. Otherwise we depend on the other gems to keep those keys on their locales files, if for any reason a version of those gems changes the messages, it could affect our gem. I'll have to check the rest of the code for the same thing, but for this PR, please make sure any localized message YOU use in the code has an entry in our locales file (the entire message always as some languages might have a completely different way to say something)

spec/requests/mutations/resend_confirmation_spec.rb Outdated Show resolved Hide resolved
Copy link
Member

@mcelicalderon mcelicalderon left a comment

Choose a reason for hiding this comment

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

Good job, thanks! I will review all locales in the gem and then release a new version with your changes 🙌

@mcelicalderon mcelicalderon merged commit 97d1c7e into graphql-devise:master Nov 24, 2019
@mcelicalderon mcelicalderon added the enhancement New feature or request label Nov 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants