-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
feat: create formatPhoneNumber util function #16804
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] |
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.
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 |
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.
Looks good to me. @rushatgabhane are you good with everything as well?
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.
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!
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.
@puneetlath LGTM!
✋ 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 🚀
|
@@ -85,7 +85,7 @@ class CloseAccountPage extends Component { | |||
} | |||
|
|||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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);
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.
Ah crap, nice catch.
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 for commenting!
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 Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Web
Mobile Web - Chrome
Mobile Web - Safari
Desktop
iOS
Android