Skip to content

LG-10123: Add data model for notification SMS numbers#8682

Merged
sheldon-b merged 7 commits intomainfrom
sbachstein/lg-10123-in-person-sms-data-model
Jul 3, 2023
Merged

LG-10123: Add data model for notification SMS numbers#8682
sheldon-b merged 7 commits intomainfrom
sbachstein/lg-10123-in-person-sms-data-model

Conversation

@sheldon-b
Copy link
Contributor

🎫 Ticket

LG-10123

🛠 Summary of changes

  • Added a new data model for storing the SMS phone number to use for SMS notifications related to the in-person proofing flow
  • A follow-up PR will add a feature flag and begin saving users' phone numbers to this table

@sheldon-b sheldon-b force-pushed the sbachstein/lg-10123-in-person-sms-data-model branch from 1859259 to e0f801a Compare June 28, 2023 16:30
@sheldon-b sheldon-b requested review from a team and allthesignals and removed request for a team June 28, 2023 16:30
@sheldon-b sheldon-b force-pushed the sbachstein/lg-10123-in-person-sms-data-model branch from e0f801a to 968d19b Compare June 29, 2023 18:29
Copy link
Contributor

@zachmargolis zachmargolis left a comment

Choose a reason for hiding this comment

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

LGTM

Maybe we can add it later when we get there, but we could also add user.notification_phone_configurations as a has_many ..., :through relation? docs link

@sheldon-b sheldon-b marked this pull request as draft June 30, 2023 13:10
@sheldon-b sheldon-b force-pushed the sbachstein/lg-10123-in-person-sms-data-model branch from fb1afc7 to 4bc9ef4 Compare June 30, 2023 15:04
Comment on lines +10 to +13
return '' if phone.blank?

formatted = Phonelib.parse(phone).national
formatted[0..-5].gsub(/\d/, '*') + formatted[-4..-1]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This could use some fresh eyes -- for now I've just copied the implementation over from PhoneConfiguration. A separate PR/ticket will refresh this

Copy link
Contributor

Choose a reason for hiding this comment

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

it looks good to me. What will the purpose of the refresh be?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It has a different interface from the above format method -- this one returns an empty string for invalid phone numbers and format returns nil. And this one is focused on national numbers whereas format has explicit support for international. That's all I have in mind

@sheldon-b sheldon-b marked this pull request as ready for review June 30, 2023 18:28

def formatted_phone
Phonelib.parse(phone).international
PhoneFormatter.format(phone)
Copy link
Contributor

Choose a reason for hiding this comment

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

It took me some digging, but I'm confident that these two are equivalent; PhoneFormatter.format sends 'US' as the country_code, which the code you're replacing does not, but we set Phonelib's default country to 'US' in config/initializers/phonelib.rb.

Comment on lines +10 to +13
return '' if phone.blank?

formatted = Phonelib.parse(phone).national
formatted[0..-5].gsub(/\d/, '*') + formatted[-4..-1]
Copy link
Contributor

Choose a reason for hiding this comment

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

it looks good to me. What will the purpose of the refresh be?

@sheldon-b sheldon-b merged commit a5841e3 into main Jul 3, 2023
@sheldon-b sheldon-b deleted the sbachstein/lg-10123-in-person-sms-data-model branch July 3, 2023 14:26
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.

4 participants