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

[Bug] Fix user role from removing email #6111

Merged
merged 1 commit into from
Mar 30, 2023

Conversation

esizer
Copy link
Member

@esizer esizer commented Mar 29, 2023

πŸ€– Resolves #6103

πŸ‘‹ Introduction

This prevents role updates from overriding the user email to null.

πŸ•΅οΈ Details

We were setting the users email to null when it did not exist (either undefined or empty string) to prevent our validation from seeing "" as a duplicate email. This unsets the email key in our mutation variables if it is undefined so that it is only nulled when it is an empty string.

πŸ§ͺ Testing

Assist reviewers with steps they can take to test that the PR does what it says it does.

  1. Build the application npm run build
  2. Navigate to `/admin/users/{userId}/edit
  3. Add a role, confirm email is still present
  4. Remove a role, confirm email is still present
  5. Empty out the email, confirm it saves as empty
  6. Attempt to update to an existing email, confirm it fails with nice error message
  7. Attempt to update to a unique email, confirm it succeeds

Copy link
Contributor

@petertgiles petertgiles left a comment

Choose a reason for hiding this comment

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

Perfection! Nice simple solution. 🎯

@esizer esizer merged commit 74c65c9 into main Mar 30, 2023
@esizer esizer deleted the bug_6103_prevent-unwanted-email-null branch March 30, 2023 14:56
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.

Edit user role table changes null out the user's email
2 participants