Repository navigation
Remove E.164 validation for optional phone fields - #121
Conversation
gekiclaws
left a comment
There was a problem hiding this comment.
Good fix for allowing Optix phone data to save. Since Optix gives us phone as a naive string, I agree we shouldn’t reject the whole user payload just because it isn’t E.164.
The remaining issue is that phone is currently doing double duty as both raw profile data and an SMS-sendable destination. We should allow optional_phone() to store the raw trimmed string, but SMS preference/send logic should only consider the phone valid if it is actually sendable, likely E.164 for now.
Concretely, I think optional_phone() can stay permissive, but normalize_effective_notification_state() should distinguish hasPhone from hasSmsPhone, or at least require E.164 before allowing "text" in notifPrefs. Otherwise a naive Optix value like "4125551234" can be saved and may let SMS notifications get enabled, only to fail later when Twilio receives it.
…preferences - Introduced `is_e164_phone` function to validate phone numbers in E.164 format. - Updated user preferences and member service to include `hasSmsPhone` flag. - Enhanced SMS channel to skip sending messages for invalid phone numbers. - Modified tests to cover new validation logic and preferences handling.
|
Added hasSmsPhone field, whose value is determined by is_e164_phone |
Summary
Test plan
Closes #120