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

Resolves a bug(500 error) when re-using previous partner email #3955

Merged

Conversation

patelkrunal31
Copy link
Collaborator

Resolves #3886

Description

When a partner user updates their email address, there is a before_update hook where we invite users based on certain conditions.
While inviting users, we usually throw an error if updating roles for existing users with already assigned roles.
I have updated the hook to also check that the partner user doesn't exist with a similar email and role before inviting.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

I performed tests using local deployment and also using a unit test.

Screenshots

@patelkrunal31 patelkrunal31 force-pushed the kp/bug-re-using-previous-partner-email-causes-500-error branch from 7cdfad6 to 98611db Compare December 3, 2023 03:47
@@ -235,6 +235,10 @@ def invite_new_partner
end

def should_invite_because_email_changed?
email_changed? and (invited? or awaiting_review? or recertification_required? or approved?)
email_changed? and (invited? or awaiting_review? or recertification_required? or approved?) and !partner_user_with_same_email_exist?
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure why this was previously implemented with and/or instead of &&/||, but it might be worth changing it to &&/|| since we're in here anyway

@patelkrunal31 patelkrunal31 force-pushed the kp/bug-re-using-previous-partner-email-causes-500-error branch from 98611db to da25380 Compare December 3, 2023 16:14
Copy link
Collaborator

@awwaiid awwaiid left a comment

Choose a reason for hiding this comment

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

Great, thanks!

@awwaiid awwaiid merged commit 4def8dd into main Dec 3, 2023
12 checks passed
@awwaiid awwaiid deleted the kp/bug-re-using-previous-partner-email-causes-500-error branch December 3, 2023 16:25
@patelkrunal31
Copy link
Collaborator Author

@all-contributors add @patelkrunal31 for coding

Copy link
Contributor

@patelkrunal31

We had trouble processing your request. Please try again later.

@patelkrunal31
Copy link
Collaborator Author

@all-contributors add @patelkrunal31 for coding

Copy link
Contributor

@patelkrunal31

We had trouble processing your request. Please try again later.

@patelkrunal31
Copy link
Collaborator Author

@all-contributors add @patelkrunal31 for code

Copy link
Contributor

@patelkrunal31

We had trouble processing your request. Please try again later.

@patelkrunal31
Copy link
Collaborator Author

@all-contributors add @patelkrunal31 for code

Copy link
Contributor

@patelkrunal31

We had trouble processing your request. Please try again later.

Copy link
Contributor

@patelkrunal31: Your PR Resolves a bug(500 error) when re-using previous partner email is part of today's Human Essentials production release: 2023.12.10.
Thank you very much for your contribution!

@patelkrunal31
Copy link
Collaborator Author

@all-contributors add @patelkrunal31 for code

Copy link
Contributor

@patelkrunal31

We had trouble processing your request. Please try again later.

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.

[BUG]: Re-using previous partner email causes 500 error
2 participants