feat: create formatPhoneNumber util function#16804
Conversation
|
@jasperhuangg Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
jasperhuangg
left a comment
There was a problem hiding this comment.
Can we be sure to include all the pages that this touches in the testing steps?
@koko57 It looks like there's an issue with how SMS logins are getting formatted (the SMS domain shouldn't be included in those messages). Can you look into this and possibly use your new utility function there as well? More here: Lines 735 to 756 in bbcf7ce |
|
@jasperhuangg yes, of course, I'll take care of it |
Yes, the util is already used in the getDisplayNameForParticipant function. When I i.e. request money - for a split of a second the number is displayed correctly (formatted) but then as the request succeed the text is updated and the unformatted number is displayed (in the pushJSON the message includes the 'expensify.sms' domain). We are only formatting the number for the message for the optimisticData here. The data we get when we open the chat also looks like this: Correct me if I'm wrong but it seems that the message is stored that way in the backend. So if it should be fixed on the frontend side I need to create another function to format these messages correctly using the formatPhoneNumber util. |
@koko57 We should format the text right before it's displayed in addition to formatting it in the optimisticData |
I've added formatPhoneNumberInText function that takes care of that |
|
@rushatgabhane can you take the first round of review here? |
|
@puneetlath sure, thanks for assigning me! |
|
Hi folks, I was working on a related issue, #17461 and found out a pretty substantial bug that would've been introduced with this PR. Right now, we are using awesome-phonenumber version 5.3.0. This was the latest version when @koko57 started working on this PR (March 31). On April 4, a new version of awesome-phonenumber was released, which patches a bug that parsed incorrect numbers as a possible number grantila/awesome-phonenumber#98. For an instance of this bug, the number +13313212 is an invalid number. However, when this number is parsed using v5.3.0, it is returned as a possible number, which affects our conditions here. This is not an issue with v5.3.0 v5.3.1 I'd suggest to upgrade the lib to v5.3.1 before this is merged. |
|
upgraded to the latest one - 5.4.0 |
@puneetlath I think display names formatting should be handled in the follow-up issue |
puneetlath
left a comment
There was a problem hiding this comment.
Looks good to me. @rushatgabhane are you good with everything as well?
puneetlath
left a comment
There was a problem hiding this comment.
Everything looks good to me. @rushatgabhane I'd like to make sure we test again before merging though, since a lot of things are touched here. Let's try to do this today if we can to avoid more conflicts. Thanks!
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/puneetlath in version: 1.3.2-0 🚀
|
|
🚀 Deployed to production by https://github.com/mountiny in version: 1.3.2-5 🚀
|
|
|
||
| render() { | ||
| const userEmailOrPhone = Str.removeSMSDomain(this.props.session.email); | ||
| const userEmailOrPhone = this.props.formatPhoneNumber(this.props.session.email); |
There was a problem hiding this comment.
This PR caused regression - #17976.
This change should have bee applied to validation as well:
validate(values) {
const userEmailOrPhone = Str.removeSMSDomain(this.props.session.email);
|
Hey there, coming from #23724, this PR should have handled the formatting inside the report participants page. |

































Details
Fixed Issues
$ #16099
PROPOSAL: #16099(COMMENT)
Tests
--- CHAT ---
--- CONTACT METHODS ---
--- LOGIN ---
Offline tests
N/A
QA Steps
same as above
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)/** comment above it */thisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor)thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)Avataris modified, I verified thatAvataris working as expected in all cases)ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Web
Mobile Web - Chrome
Mobile Web - Safari
Desktop
iOS
Android