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-03-24] [$1000] Personal details - Signs *-+ added to the start of a Legal first name and last name don't save #15741

Closed
6 tasks done
kbecciv opened this issue Mar 8, 2023 · 31 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 8, 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 or Legal last name
  4. Enter one a symbol (like *-+) at the beginning of the Legal first name

Expected Result:

Error message should be display for unsupported symbols

Actual Result:

Signs *-+ are not stored in Legal first name and last name

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.80.0

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

Bug5968608_Gravar__2078.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/~01e1a71adab59f1386
  • Upwork Job ID: 1635395258815135744
  • Last Price Increase: 2023-03-13
@kbecciv kbecciv added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Mar 8, 2023
@melvin-bot melvin-bot bot locked and limited conversation to collaborators Mar 8, 2023
@MelvinBot
Copy link

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

@MelvinBot
Copy link

MelvinBot commented Mar 8, 2023

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

@garrettmknight
Copy link
Contributor

@kbecciv Can you point me to the slack link? I'm not sure if those symbols should be valid for legal names or not.

@kbecciv
Copy link
Author

kbecciv commented Mar 10, 2023

I don't have slack conversation for this and don't have access to slack

@melvin-bot melvin-bot bot added the Overdue label Mar 13, 2023
@MelvinBot
Copy link

@garrettmknight Whoops! This issue is 2 days overdue. Let's get this updated quick!

@garrettmknight
Copy link
Contributor

Chatting about standards in slack, will come back here when we've confirmed what requirements we have. https://expensify.slack.com/archives/C049HHMV9SM/p1678742598359799

@melvin-bot melvin-bot bot removed the Overdue label Mar 13, 2023
@garrettmknight garrettmknight added the External Added to denote the issue can be worked on by a contributor label Mar 13, 2023
@melvin-bot melvin-bot bot unlocked this conversation Mar 13, 2023
@melvin-bot melvin-bot bot changed the title Personal details - Signs *-+ are not stored in Legal first name and last name [$1000] Personal details - Signs *-+ are not stored in Legal first name and last name Mar 13, 2023
@MelvinBot
Copy link

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

@MelvinBot
Copy link

Current assignee @garrettmknight 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 - @sobitneupane (External)

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

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

@PrashantMangukiya
Copy link
Contributor

PrashantMangukiya commented Mar 13, 2023

Proposal

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

Whenever we enter symbols (e.g. *-+) within Legal first name and last name, it will not store that symbol within db and firstname/lastname return empty when once data saved within onyx.

What is the root cause of that problem?

For legal name validation we are using isValidDisplayName() as shown below (line 69, 75)

if (!ValidationUtils.isValidDisplayName(values.legalFirstName)) {
errors.legalFirstName = this.props.translate('personalDetails.error.hasInvalidCharacter');
} else if (_.isEmpty(values.legalFirstName)) {
errors.legalFirstName = this.props.translate('common.error.fieldRequired');
}
if (!ValidationUtils.isValidDisplayName(values.legalLastName)) {
errors.legalLastName = this.props.translate('personalDetails.error.hasInvalidCharacter');
} else if (_.isEmpty(values.legalLastName)) {
errors.legalLastName = this.props.translate('common.error.fieldRequired');
}

It will check for commas or semicolons at line 358 shown in code below. So it will allow special chars other than commas or semicolons. Note: Actually this function is used for profile display name settings.

function isValidDisplayName(name) {
return !name.includes(',') && !name.includes(';');
}

So for legal name if we enter special chars (other then commas or semicolons) then ui will not show any error, and when we tap Save it will call server side api that make legalFirstName or legalLastName blank due to invalid chars found within it. We can see this behaviour in the issue video.

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

We have to create isValidLegalName() function within ValidationUtils.js. It will be used to validate legal First name and Last name as shown code below.
Note: We can not use isValidDisplayName() to validate legal name because it is used to validate display name and we allow special chars in display name but in legal name we do not allow special chars.

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

Add corresponding regular expression within CONST.js file as shown below:

REGEX: {
 ....
 ALPHABETIC_CHARS_ONLY: /^[A-Za-z-]*$/,
 ....
}

So we have to adjust this regular expression to allow chars we need. At present I set a-z and A-Z and - (dash) but we can allow more char as per our need. If any existing regex there for such requirement in COST.js file then also we can use it.

Within en.js add hasInvalidCharacter error key under privatePersonalDetails as show below:

privatePersonalDetails: {
  ...
  error: {
   ...,
    hasInvalidCharacter: 'Name contains unsupported character.',
  },
},

Within es.js add hasInvalidCharacter error key under privatePersonalDetails as show below:

privatePersonalDetails: {
  ...
  error: {
   ...,
    hasInvalidCharacter: 'El nombre contiene un carácter no admitido.',
  },
},

Update validate logic as shown below. i.e. We have to use ValidationUtils.isValidLegalName() and show error message from privatePersonalDetails.error.hasInvalidCharacter.

if (!ValidationUtils.isValidLegalName(values.legalFirstName)) {  // *** Updated code ***
    errors.legalFirstName = this.props.translate('privatePersonalDetails.error.hasInvalidCharacter');  // *** Updated code ***
} else if (_.isEmpty(values.legalFirstName)) {
    errors.legalFirstName = this.props.translate('common.error.fieldRequired');
}

if (!ValidationUtils.isValidLegalName(values.legalLastName)) {  // *** Updated code ***
    errors.legalLastName = this.props.translate('privatePersonalDetails.error.hasInvalidCharacter');  // *** Updated code ***
} else if (_.isEmpty(values.legalLastName)) {
    errors.legalLastName = this.props.translate('common.error.fieldRequired');
}

What alternative solutions did you explore? (Optional)

None

@Prince-Mendiratta
Copy link
Contributor

Proposal

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

In the Personal Details > Legal Name section, we do not allow the user to have any special characters in their names.

What is the root cause of that problem?

This is because of backend validation. The reason behind confusing behaviour is because we do not restrict the values or show any error on the frontend and when values are sent to the backend, they are filtered and updated on the frontend, causing confusion.

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

Across the world, there are many cultures and different countries have different allowed Legal names. I was able to find a very good article on this. The most common however, include the use of hyphens, apostrophes and periods. Many a times, people also have a middle name as well.

I propose that we create a new function in the validation utils specifically for validating the legal name. It can use a regex that allows:

  1. apostrophes (')
  2. periods (.)
  3. whitespace ( )
  4. hyphen (-)
  5. Letters (uppercase+lowercase)
  6. Plus (+)

This will allow a user which has a legal name > 2 words to enter their name as well. We could also potentially create a new field just for middle name. For any other inputs not matching the above conditions, we will show an error with the allowed characters. Moreover, currently we allow to save the form with empty spaces only, which will also be fixed using my proposal.

This issue will require changes on the backend as well.

@PauloGasparSv
Copy link
Contributor

Hey @Prince-Mendiratta I think we strip some of those characters in the API side before the request gets to the endpoint. But you made a very valid point about which characters we should be allowing here.

I think the API is only ready for accepting numbers and letters for that field, so that's what we should be allowing in the App!

@PauloGasparSv
Copy link
Contributor

@sobitneupane I think we already have 2 good proposals here that can fix the problem, could you share your thoughts on them?

@garrettmknight garrettmknight changed the title [$1000] Personal details - Signs *-+ are not stored in Legal first name and last name [$1000] Personal details - Signs *-+ added to the start of a Legal first name and last name don't save Mar 14, 2023
@sobitneupane
Copy link
Contributor

Thanks for the proposal @PrashantMangukiya and @Prince-Mendiratta.

Proposal from @PrashantMangukiya looks good to me.

🎀👀🎀 C+ reviewed

cc: @PauloGasparSv

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Mar 15, 2023
@PauloGasparSv PauloGasparSv removed the Daily KSv2 label Mar 15, 2023
@PrashantMangukiya
Copy link
Contributor

Thanks @PauloGasparSv @sobitneupane Applied to job on Upwork. I will submit PR within few hours asap.

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Mar 15, 2023
@melvin-bot melvin-bot bot changed the title [$1000] Personal details - Signs *-+ added to the start of a Legal first name and last name don't save [HOLD for payment 2023-03-24] [$1000] Personal details - Signs *-+ added to the start of a Legal first name and last name don't save Mar 17, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Mar 17, 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.86-1 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-03-24. 🎊

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 Mar 17, 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:

@MelvinBot
Copy link

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.

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Mar 23, 2023
@PrashantMangukiya
Copy link
Contributor

Ping for Upwork

@melvin-bot melvin-bot bot added the Overdue label Mar 27, 2023
@PauloGasparSv
Copy link
Contributor

Not overdue, filling my part of the checklist today : )

@PrashantMangukiya
Copy link
Contributor

Ping for Upwork. Should I also eligible for timeline bonus as pr merged within three business days.

@sobitneupane
Copy link
Contributor

Regression Test Proposal

  1. Navigate to Settings -> Profile -> Personal details
  2. Navigate to the Legal name page
  3. Enter one or more symbol (like *-+) at the beginning or anywhere within Legal first name or last name fields.
  4. Verify that error message is shown.

Do we agree 👍 or 👎

@garrettmknight
Copy link
Contributor

@PrashantMangukiya just paid you and closed the contract.
@sobitneupane just sent you an offer, once you accept and we finish off the regression test I'll pay and close the contract.

@PrashantMangukiya
Copy link
Contributor

@garrettmknight Received Thank you for your time.

@sobitneupane
Copy link
Contributor

@garrettmknight Accepted the offer

@garrettmknight
Copy link
Contributor

Paid and contract ended. @sobitneupane can you link the reg testing step issue here when you get a chance?

@sobitneupane
Copy link
Contributor

@garrettmknight I am not familiar with TestRail. According to https://expensify.slack.com/archives/C02NK2DQWUX/p1679650722829939?thread_ts=1679597927.757039&cid=C02NK2DQWUX, Applause will find the appropriate location to add the test steps.

@garrettmknight
Copy link
Contributor

Thanks @sobitneupane - all done!

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

7 participants