Closed kavimuru closed 1 year ago
Triggered auto assignment to @strepanier03 (Bug
), see https://stackoverflow.com/c/expensify/questions/14418 for more details.
Platforms
in OP are ✅)Please re-state the problem that we are trying to solve in this issue.
What is the root cause of that problem?
What changes do you think we should make in order to solve the problem?
On NewContactMethodPage.js
-> we need to trim value at onLoginChange()
and remove trim from validateForm()
since we are limiting the white space at first place so need to to extra trim for submit button
Changes
onLoginChange(login) {
const validate = login.trim(); this.setState({login:validate}); }
/**
const login = this.state.login const phoneLogin = LoginUtils.getPhoneNumberWithoutSpecialChars(login);
return (Permissions.canUsePasswordlessLogins(this.props.betas) || this.state.password)
&& (Str.isValidEmail(login) || Str.isValidPhone(phoneLogin));
}
What alternative solutions did you explore? (Optional)
Posting proposal early as per new guidelines
Leading whitespaces aren not truncated while saving email/phone number in new contact method page.
We can see within onLoginChange()
we do not trim login
before save to state, so login value will be with leading and trailing space if entered.
https://github.com/Expensify/App/blob/4f7cfdb53216185ac7e825127b3be2f8238340fd/src/pages/settings/Profile/Contacts/NewContactMethodPage.js#L68-L70
Also during submitForm()
we do not trim this.state.login
as shown below,
https://github.com/Expensify/App/blob/4f7cfdb53216185ac7e825127b3be2f8238340fd/src/pages/settings/Profile/Contacts/NewContactMethodPage.js#L85-L92
So User.addNewContactMethodAndNavigate()
method will save login
value with leading and trailing space. This is the root cause of the problem.
To solve this we can think to trim login while save to state at line 69 within onLoginChange()
.
But it is not advisable because user may enter Email Or Phone number within login field. So if user typing email then trim() during save to state will be ok, because generally blank space not comes within email so user will not try to enter blank space within email.
But if user enter Phone number then user have habit to enter phone number like "123 4567 8901" i.e. with space. So if we trim value during onChange, then as soon as user type space within phone number onLoginChange() will trim space during save to state. So it will make bad user experience and user will not able to enter space within phone number.
So better approach is to trim login within submitForm()
function and use trimmed login value for lodashGet()
and addNewContactMethodAndNavigate()
api. So modified submitForm()
function code looks as shown below.
submitForm() {
// Trim leading and trailing space from login
const login = this.state.login.trim();
// If this login already exists, just go back.
if (lodashGet(this.props.loginList, login)) {
Navigation.navigate(ROUTES.SETTINGS_CONTACT_METHODS);
return;
}
User.addNewContactMethodAndNavigate(login, this.state.password);
}
So this will solve the issue i.e. truncate leading/trailing white space from email or phone number, and allows to enter space within phone number. Result video attached below.
None.
Looks like something related to react-navigation
may have been mentioned in this issue discussion.
As a reminder, please make sure that all proposals are not workarounds and that any and all attempt to fix the issue holistically have been made before proceeding with a solution. Proposals to change our DeprecatedCustomActions.js
files should not be accepted.
Feel free to drop a note in #expensify-open-source with any questions.
Able to recreate following instructions but oddly I have the email listed twice, once with the extra spaced and once without.
Job added to Upwork: https://www.upwork.com/jobs/~01b41c774d839dccd0
Current assignee @strepanier03 is eligible for the External assigner, not assigning anyone new.
Triggered auto assignment to Contributor-plus team member for initial proposal review - @Santhosh-Sellavel (External
)
Triggered auto assignment to @luacmartins (External
), see https://stackoverflow.com/c/expensify/questions/7972 for more details.
@PrashantMangukiya's Proposal LGTM, straight forward change!
C+ Reviewed 🎀 👀 🎀
📣 @PrashantMangukiya You have been assigned to this job by @luacmartins! Please apply to this job in Upwork and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑💻 Keep in mind: Code of Conduct | Contributing 📖
@Santhosh-Sellavel @luacmartins If we allow space on the phone number then case I think the issue will remain the same for the phone right?
It won't create the current issue, we are just trying to trim out leading and trailing space. So we are good here.
If you are talking about space between the phone numbers, that's an invalid phone number case we got already covered with showing an error. So we are good to go here too.
But restricting user input is bad UX.
@Santhosh-Sellavel @luacmartins Thank you. Applied to job on Upwork. I will prepare and submit PR within 3 hours asap.
Reviewing
label has been removed, please complete the "BugZero Checklist".
The solution for this issue has been :rocket: deployed to production :rocket: in version 1.3.5-6 and is now subject to a 7-day regression period :calendar:. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2023-05-03. :confetti_ball:
After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.
Speed bonus analysis: PR submitted on April 21 / PR merged on April 25 = Eligible
As a reminder, here are the bonuses/penalties that should be applied for any External issue:
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
Just getting back from out of office and working to catch up on this now. I'll have an update shortly.
@ashimsharma10 - I have hired you to a bug report job in Upwork.
@Santhosh-Sellavel and @PrashantMangukiya - I have hired you to the Upwork job as well.
@Santhosh-Sellavel - If you can finish the BZ checklist I'll update the comment and make any necessary reg test GHs.
I'll check in later today to pay what I can.
@strepanier03 Offer accepted on Upwork.
@PrashantMangukiya and @ashimsharma10, I have paid you both via Upwork and closed contracts, thank you both!
@strepanier03 Received, Thank you.
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
- [x] [@Santhosh-Sellavel] The PR that introduced the bug has been identified. Link to the PR: https://github.com/Expensify/App/pull/15330
- [x] [@Santhosh-Sellavel] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:https://github.com/Expensify/App/pull/15330/files#r1186882779
- [x] [@Santhosh-Sellavel] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion: Not need I guess.
- [x] [@Santhosh-Sellavel] Determine if we should create a regression test for this bug.
- [x] [@Santhosh-Sellavel] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again. https://github.com/Expensify/App/issues/17770#issuecomment-1537490190
- [x] [@strepanier03] Link the GH issue for creating/updating the regression test once above steps have been agreed upon: https://github.com/Expensify/Expensify/issues/281858
cc: @luacmartins let me know if differ on anything, thanks!
From the PR itself looks good to me
👍 or 👎
cc: @luacmartins or @strepanier03
@strepanier03 Accepted offer thanks!
REg test added and payment finalized. Going to close this now.
Thank you everyone!
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Action Performed:
Expected Result:
Leading or trailing spaces should be removed and email.phone number should be displayed accordingly for better UI
Actual Result :
Leading spaces makes improper indentation while display.
Workaround:
Can the user still use Expensify without this being fixed? Have you informed them of the workaround?
Platforms:
Which of our officially supported platforms is this issue occurring on?
Version Number: 1.3.3 Reproducible in staging?: y Reproducible in production?: y If this was caught during regression testing, add the test name, ID and link from TestRail: Email or phone of affected tester (no customers): Logs: https://stackoverflow.com/c/expensify/questions/4856 Notes/Photos/Videos: Any additional supporting documentation
https://user-images.githubusercontent.com/43996225/233529701-d5974fa3-e27f-4ce8-b726-f489357e43a3.mov
Expensify/Expensify Issue URL: Issue reported by: @ashimsharma10 Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1681998814607449
View all open jobs on GitHub
Upwork Automation - Do Not Edit