Skip to content
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

[HOLD for payment 2023-04-17] [$1000] Profile - Personal Details- Able to save Fist and Last name fields with One space #16611

Closed
6 tasks done
kbecciv opened this issue Mar 28, 2023 · 38 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@kbecciv
Copy link

kbecciv commented Mar 28, 2023

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:

  1. Log in with a brand new account
  2. Navigate to Settings -> Profile -> Personal details
  3. Navigate to the Legal name page
  4. Enter 1 space to field First/ Last Name and save.

Expected Result:

Unable to save Fist and Last name fields with One space

Actual Result:

The form is saved without issue.

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: 1.2.90.6

Reproducible in staging?: Yes

Reproducible in production?: Yes

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

Bug5995857_space.mp4

Expensify/Expensify Issue URL:

Issue reported by: Applause - Internal Team

Slack conversation:

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01c107dbee7d205160
  • Upwork Job ID: 1641457403150352384
  • Last Price Increase: 2023-03-30
@kbecciv kbecciv added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Mar 28, 2023
@MelvinBot
Copy link

Triggered auto assignment to @NicMendonca (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@MelvinBot
Copy link

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@NicMendonca

This comment was marked as off-topic.

@NicMendonca
Copy link
Contributor

Ah, I just noticed that we do throw an error that its mandatory, so I agree you shouldn't be able to save it without text.

@NicMendonca NicMendonca added the External Added to denote the issue can be worked on by a contributor label Mar 30, 2023
@melvin-bot melvin-bot bot changed the title Profile - Personal Details- Able to save Fist and Last name fields with One space [$1000] Profile - Personal Details- Able to save Fist and Last name fields with One space Mar 30, 2023
@MelvinBot
Copy link

Job added to Upwork: https://www.upwork.com/jobs/~01c107dbee7d205160

@MelvinBot
Copy link

Current assignee @NicMendonca is eligible for the External assigner, not assigning anyone new.

@MelvinBot
Copy link

Triggered auto assignment to Contributor-plus team member for initial proposal review - @rushatgabhane (External)

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Mar 30, 2023
@PrashantMangukiya
Copy link
Contributor

Proposal

Please re-state the problem that we are trying to solve in this issue.

Profile - Personal Details- Able to save Fist and Last name fields with One space.

What is the root cause of that problem?

Within LegalNamePage.js file we are doing empty validation for legalFirstName and legalLastName as shown below.

} else if (_.isEmpty(values.legalFirstName)) {

} else if (_.isEmpty(values.legalLastName)) {

For strings and array-like objects _.isEmpty() will checks if the length property is 0 then it will consider it empty, otherwise not, so here we are passing legalFirstName and legalLastName with one space so it will not consider it empty, this is the root cause of the problem.

What changes do you think we should make in order to solve the problem?

Within LegalNamePage.js trim values.legalFirstName and values.legalLastName at line 71 and 77 during empty validation. It will solve the problem and not allow one or multiple space.

// _.isEmpty(values.legalFirstName)     // *** OLD ***  
_.isEmpty(values.legalFirstName.trim())    // *** UPDATED ***

// _.isEmpty(values.legalLastName)  // *** OLD ****
_.isEmpty(values.legalLastName.trim())   // *** UPDATED ***

What alternative solutions did you explore? (Optional)

None

Results

OneSpace.mov

@MelvinBot
Copy link

Triggered auto assignment to @jasperhuangg (External), see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@Pujan92
Copy link
Contributor

Pujan92 commented Mar 30, 2023

Proposal

Please re-state the problem that we are trying to solve in this issue.

Legal names allow spaces in the field

What is the root cause of that problem?

We are allowing space as per the regex for legal names here

ALPHABETIC_CHARS_WITH_NUMBER: /^[a-zA-Z0-9 ]*$/,

What changes do you think we should make in order to solve the problem?

Remove space from regex which won't allow space in the first and last legal name and shows the error which prevents the form from saving.

@PrashantMangukiya
Copy link
Contributor

@Pujan92 that ALPHABETIC_CHARS_WITH_NUMBER: /^[a-zA-Z0-9 ]*$/, is ok.

We added it as a solution of this issue #15741 As we do not allow any special chars and we have to allow space because some people has space in First name or Middle name etc. So that regular expression is ok for solving that problem and we can not remove space from that.

Here actual problem is, when input has only space (without any chars) at that time it will go to _.isEmpty(values.legalFirstName) and it will consider as valid due to below reason.

For strings and array-like objects _.isEmpty() will checks if the length property is 0 then it will consider it empty, otherwise not, so here we are passing legalFirstName and legalLastName with one space so it will not consider it empty, this is the root cause of the problem.

@rushatgabhane
Copy link
Member

rushatgabhane commented Mar 30, 2023

Should we make the change in Form.js instead? And do it for all inputs

@PrashantMangukiya
Copy link
Contributor

@rushatgabhane Note sure to add within Form.js is a good idea or not. I am sceptical that it should create issue for others places as Form.js is used many places. So I do not prefer this.

@Pujan92
Copy link
Contributor

Pujan92 commented Mar 30, 2023

@PrashantMangukiya as the error message says Name can only include letters and numbers. I thought space should not be allowed in those names.

@Riddhi2291
Copy link

@PrashantMangukiya
ALPHABETIC_CHARS_WITH_NUMBER: ^[a-zA-Z]+(?: [a-zZA-Z]+)?$
This Regx will allow only single space between 2 words(alphabets only)

@MelvinBot
Copy link

📣 @Riddhi2291! 📣

Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:

  1. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  2. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  3. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.

Screen Shot 2022-11-16 at 4 42 54 PM

Format:

Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

@PrashantMangukiya
Copy link
Contributor

@Pujan92 Thank you. During pr review we decided to allow space #15989 (comment) and set such message, so it match with server side api that accepts numbers like "Paulo 1st" or "John the 2nd" etc. Thank you.

@alexxxwork
Copy link
Contributor

alexxxwork commented Mar 30, 2023

Proposal

Please re-state the problem that we are trying to solve in this issue.

We can use space as legal name

What is the root cause of that problem?

The regex expression to test the name contains space

What changes do you think we should make in order to solve the problem?

We can add a new regex in CONST.js to test Legal Name and update test expression here:

function isValidLegalName(name) {
return CONST.REGEX.ALPHABETIC_CHARS_WITH_NUMBER.test(name);
}

Also I think we need more letters than a-zA-z
regex:
LEGAL_NAME: /^[A-Za-zÀ-ÿ][a-zA-ZÀ-ÿ0-9 ]+$/

@PrashantMangukiya
Copy link
Contributor

@PrashantMangukiya ALPHABETIC_CHARS_WITH_NUMBER: ^[a-zA-Z]+(?: [a-zZA-Z]+)?$ This Regx will allow only single space between 2 words(alphabets only)

No worry here we are dealing with different thing as mentioned in issue title.

Profile Personal Details- Able to save Fist and Last name fields with One space

@rushatgabhane
Copy link
Member

Note sure to add within Form.js is a good idea or not. I am sceptical that it should create issue for others places as Form.js is used many places. So I do not prefer this.

How so? Can you give me an example?

@PrashantMangukiya
Copy link
Contributor

@rushatgabhane I did not explored Form.js component fully yet. So my understanding related to Form.js component is limited. So have no suggestion for that.

@rushatgabhane
Copy link
Member

oh okayy no problem :)

@tienifr
Copy link
Contributor

tienifr commented Mar 31, 2023

Proposal

Please re-state the problem that we are trying to solve in this issue.

Profile - Personal Details- Able to save Fist and Last name fields with One space

What is the root cause of that problem?

We don't have the logic to trim the value in the Form component

What changes do you think we should make in order to solve the problem?

In the Form Component, We should trim all values before validating the value like
in here:

validate(values) {

add this logic to trim values

 const trimmedValues = {};
 _.each(values, (inputValue, inputID) => _.isString(inputValue) && (trimmedValues[inputID] = inputValue.trim()));

And using the trimmedValued instead of values in validate function

My solution also fixes the same problem in all other places using Form Component like the Company Address Field in CompanyStep Page

If we come up with this approach, we also remove the trim function in some places to clean

What alternative solutions did you explore? (Optional)

NA

Result

Screen.Recording.2023-03-31.at.15.27.21.mov

@jasperhuangg
Copy link
Contributor

@Pujan92 @alexxxwork I tested your proposals and they don't see to work

@tienifr your proposal makes sense to me and seems to work, it also fixes this issue in other components where we use the form, assigned!

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Apr 1, 2023
@MelvinBot
Copy link

📣 @tienifr You have been assigned to this job by @jasperhuangg!
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 📖

@rushatgabhane
Copy link
Member

@tienifr ping me here once you raise a PR, thanks!

@alexxxwork
Copy link
Contributor

alexxxwork commented Apr 1, 2023

@Pujan92 @alexxxwork I tested your proposals and they don't see to work

@tienifr your proposal makes sense to me and seems to work, it also fixes this issue in other components where we use the form, assigned!

@jasperhuangg Regex testing don't work?
Trimming before regex test seems to be more like a workaround and modifying regex fixes this issue and potential problems with Spanish legal names.

@rushatgabhane
Copy link
Member

Trimming before regex test seems to be more like a workaround

@alexxxwork could you please explain why it's a workaround?

@tienifr
Copy link
Contributor

tienifr commented Apr 2, 2023

@rushatgabhane The PR is created. Please help to review it, thanks

@tienifr
Copy link
Contributor

tienifr commented Apr 7, 2023

Regression Test Proposal

Bug: Profile - Personal Details- Able to save Fist and Last name fields with One space

Proposed Test Steps:

  1. Navigate to Settings -> Profile -> Personal details > Legal name
  2. Enter one or more spaces to field First/ Last Name and click outside input (or click save).
  3. Verify that the error appears with the message "This field is required"

Do we 👍 or 👎

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Daily KSv2 labels Apr 10, 2023
@melvin-bot melvin-bot bot changed the title [$1000] Profile - Personal Details- Able to save Fist and Last name fields with One space [HOLD for payment 2023-04-17] [$1000] Profile - Personal Details- Able to save Fist and Last name fields with One space Apr 10, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Apr 10, 2023
@MelvinBot
Copy link

Reviewing label has been removed, please complete the "BugZero Checklist".

@MelvinBot
Copy link

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.2.97-2 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2023-04-17. 🎊

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.

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@MelvinBot
Copy link

MelvinBot commented Apr 10, 2023

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:

  • [@rushatgabhane / @jasperhuangg] The PR that introduced the bug has been identified. Link to the PR:
  • [@rushatgabhane / @jasperhuangg] 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:
  • [@rushatgabhane / @jasperhuangg] 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:
  • [@NicMendonca] Determine if we should create a regression test for this bug.
  • [@rushatgabhane] 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.
  • [@NicMendonca] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@rushatgabhane
Copy link
Member

Just a polish to the Form component where we trim all string values. I don't think we need to do the Bug checklist here

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Apr 17, 2023
@NicMendonca
Copy link
Contributor

@tienifr
Copy link
Contributor

tienifr commented Apr 18, 2023

@NicMendonca applied, thanks!

@NicMendonca
Copy link
Contributor

@rushatgabhane @tienifr - paid 🎉

@NicMendonca
Copy link
Contributor

NicMendonca commented Apr 18, 2023

@rushatgabhane @tienifr I don't know what happened there 😅 now both are paid! Sorry!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

10 participants