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

MPP-3726 Set and get when user profile phone was registered #4372

Merged
merged 7 commits into from
Feb 1, 2024

Conversation

say-yawn
Copy link
Contributor

@say-yawn say-yawn commented Feb 1, 2024

New feature description

To supply helpful data to users on Relay add-on's phone tab, provide when the user set registered their phone.
/api/v1/profiles has a new key date_phone_registered that:

  • If user does not have RealPhone set return None
  • If user does have RealPhone set return verified_date
  • If user does have RelayNumber and created_at date is not None, return created_at

How to test

Go to /api/v1/profiles and check that there is date_phone_registered that returns the values described in above section

Checklist (Definition of Done)

  • Product Owner accepted the User Story (demo of functionality completed) or waived the privilege.
  • All acceptance criteria are met.
  • Jira ticket has been updated (if needed) to match changes made during the development process.
  • Commits in this PR are minimal and [have descriptive commit m

Use Realphone.verified_date if it exists
Fix MPP-3726
Set NULL for older RelayNumbers that we do not know when it was created.
Fix MPP-3726
For older RelayNumbers with created_at as None, use RealPhone.verified_date
For new RelayNumbers with created_at auto set, user RelayNumber.created_at
Fix MPP-3726
@say-yawn say-yawn requested a review from jwhitlock February 1, 2024 19:01
Copy link
Member

@jwhitlock jwhitlock left a comment

Choose a reason for hiding this comment

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

Thanks @say-yawn! This looks good, and I like the tests as well.

I think @override_settings(PHONES_NO_CLIENT_CALLS_IN_TEST=True) is a better solution than disconnecting and reconnecting the signal, and makes it unnecessary to disconnect the signal. Let's simplify the code and just use @override_settings as a class decorator.

return None
except RelayNumber.DoesNotExist:
return real_phone.verified_date
return relay_number.created_at or real_phone.verified_date
Copy link
Member

Choose a reason for hiding this comment

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

Clever, I wondered how you were going to do this without populating created_at

assert self.profile.has_phone is True


@pytest.mark.skipif(not settings.PHONES_ENABLED, reason="PHONES_ENABLED is False")
Copy link
Member

Choose a reason for hiding this comment

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

👍 good use of this decorator

emails/tests/models_tests.py Outdated Show resolved Hide resolved
@@ -182,7 +182,7 @@ def mark_verified(self):
return self


@receiver(post_save, sender=RealPhone)
@receiver(post_save, sender=RealPhone, dispatch_uid="realphone_post_save")
Copy link
Member

Choose a reason for hiding this comment

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

Even though we don't need it for this change, a dispatch_uid is still a good idea, so please keep this.

Copy link
Member

@jwhitlock jwhitlock left a comment

Choose a reason for hiding this comment

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

Thanks, looks great!

@say-yawn say-yawn added this pull request to the merge queue Feb 1, 2024
Merged via the queue into main with commit 3019afa Feb 1, 2024
27 checks passed
@say-yawn say-yawn deleted the MPP-3726-verified-Return-real-phone-registered-date branch February 1, 2024 22:17
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.

2 participants