-
Notifications
You must be signed in to change notification settings - Fork 183
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
MPP-3726 Set and get when user profile phone was registered #4372
Conversation
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
Fix style errors from black
There was a problem hiding this 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 |
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
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
@@ -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") |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, looks great!
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 keydate_phone_registered
that:How to test
Go to
/api/v1/profiles
and check that there isdate_phone_registered
that returns the values described in above sectionChecklist (Definition of Done)