fix: unverified primary emails break Emails and Users page
Created by: abeatrix
To close https://github.com/sourcegraph/sourcegraph/issues/29120
This has also been raised by a customer as this blocked them from using code monitor (Slack thread)
Issue: unverified primary emails break Emails and Users page
Steps to reproduce
- Log in as a Site Admin > Create a new user without an email 2 Then go to the Users page, look for the newly created user
- Click on the username > Emails > add a new email address
- The Emails page will be stuck in loading
- Refreshing the page would display an error message but nothing can be done in the UI
- It would also break the Users page for Site Admin, again, nothing can be done in the UI to reverse this
Root cause - Frontend
- Problem: The User Settings Emails Page will ONLY display error message when an error is presented.
- This prevents users / site admins to make any changes through the UI when an error occurs
- In this case, users and site admins are not able to verify or remove the emails that breaks the page
- Solution suggested in this PR:
- Display both the error message AND the Emails settings component that allows users and site admin to be aware of the error messages and provide them with the ability to fix them
- Users can see the Emails page UI that allows them to remove unverified email / Resend verification email / add new emails etc
Root cause - Backend:
- Problem: The IsPrimary function returns an error saying
User email not found
if primary email is not verified, when it should just return false - Solution suggested in this PR:
Test plan
manually tested?