mozilla / fx-private-relay

Keep your email safe from hackers and trackers. Make an email alias with 1 click, and keep your address to yourself.
https://relay.firefox.com
Other
1.49k stars 177 forks source link

MPP-3897: Add managers to RealPhone to handle multiple phones per user #5044

Closed jwhitlock closed 2 months ago

jwhitlock commented 2 months ago

This PR adds managers with helper methods to RealPhone, and updates the code to use them. The managers and methods:

This PR fixes a few bugs around RealPhone queries when a user has multiple RealPhone records, like a verified RealPhone and some unverified RealPhone for other numbers they tried:

How to test: Unit tests should be sufficient. If you want to try live tests, ensure you add an unverified RealPhone before a verified RealPhone. The code will not allow you to register a new RealPhone if you have a verified one.

sentry-io[bot] commented 2 months ago

🔍 Existing Issues For Review

Your pull request is modifying functions with the following pre-existing issues:

📄 File: phones/models.py

Function Unhandled Issue
relaynumber_post_save RealPhone.MultipleObjectsReturned: get() returned more than one RealPhone -- it returned 2! ...
Event Count: 1
📄 File: privaterelay/models.py (Click to Expand) | Function | Unhandled Issue | | :------- | :----- | | **`date_phone_registered`** | [**RealPhone.MultipleObjectsReturned: get() returned more than one RealPhone -- it returned 2!**](https://mozilla.sentry.io/issues/5850093040/?referrer=github-open-pr-bot) ...
`Event Count:` **5** |

Did you find this useful? React with a 👍 or 👎