Repository navigation
Update display name front-end validation to match back-end - #14873
Conversation
|
@mollfpr @youssef-lr One of you needs to 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] |
|
I'm having trouble getting my iOS simulator to work, but otherwise everything should be ready for review. |
Reviewer Checklist
Screenshots/VideosWeb14873.Web.movMobile Web - Chrome14873.mWeb.Chrome.movMobile Web - Safari14873.mWeb.Safari.mp4Desktop14873.Desktop.moviOS14873.iOS.mp4Android14873.Android.mov |
|
Input Screen.Recording.2023-02-07.at.14.13.13.mov |
|
Nice catch @mollfpr. I'll look into it. |
|
I'm going to bow out of this PR review for #focus. |
|
Thank you @mollfpr! @youssef-lr could you also give this a review please? |
|
I can take a look today. |
neil-marcellini
left a comment
There was a problem hiding this comment.
Looking pretty great overall. I like how you have simplified this a lot. There's a few small changes I would like to see. Also I think it would be good to include tests for each page that was modified here, just in case.
| if (doesFirstNameHaveInvalidCharacters) { | ||
| errors.firstName = this.props.translate('personalDetails.error.hasInvalidCharacter'); | ||
| } else if (ValidationUtils.doesContainReservedWord(values.firstName, CONST.DISPLAY_NAME.RESERVED_FIRST_NAMES)) { | ||
| errors.firstName = this.props.translate('personalDetails.error.containsReservedWord'); |
There was a problem hiding this comment.
:issue We should display multiple error messages at the same time if multiple validations fail, as we state in the form guidelines. For example, if I set my first name to Concierge; I should see First name cannot contain the words Expensify or Concierge. Name cannot contain a comma or semicolon..
suggestion: We can easily join the error messages together.
There was a problem hiding this comment.
suggestion: We can easily join the error messages together.
I'm not sure we do this in any of our other forms?
There was a problem hiding this comment.
Agreed, could you give an example of a form that does this? Because that would require copy variations and conditions for each combination of errors. Or I guess appending the error to errors.firstName instead of replacing it.
There was a problem hiding this comment.
I don't think we currently do this in any of our forms. I'll ask in Slack if we want to do this. If not then I'm happy with what we have and we should update the form guidelines.
There was a problem hiding this comment.
I'll make this a NAB comment. If we decide to make the change I'll create a refactor issue.
There was a problem hiding this comment.
Alright sounds good. I'm going to go ahead and merge then. Thanks for starting the slack discussion @neil-marcellini.
|
Looks good to me and tested well! Just a question @puneetlath, Keeping the first name empty and last name as 'Concierge' will still result in a display name that says 'Concierge'. Is this fine? |
|
@youssef-lr Yup, we already addressed that here. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
Performance Comparison Report 📊Significant Changes To DurationThere are no entries Meaningless Changes To DurationShow entries
Show details
|
|
🚀 Deployed to staging by https://github.com/puneetlath in version: 1.2.72-0 🚀
|
|
🚀 Deployed to production by https://github.com/francoisl in version: 1.2.72-1 🚀
|
|
Hey everyone, following the BugZero checklist for #15741 here. We implemented the same validation rules for both the "Display name" and the "Legal Name" in this P.R. but I think the latter has different more strict rules (that don't allow special characters for example). Because of that, newDot allowed some special characters in the "Legal Name" fields but after saving it the API was stripping them away in the Onyx response. Video of the bugBug5968608_Gravar__2078.mp4 |
| // Then we validate the last name field | ||
| if (!ValidationUtils.isValidDisplayName(values.lastName)) { | ||
| errors.lastName = this.props.translate('personalDetails.error.hasInvalidCharacter'); | ||
| } |
There was a problem hiding this comment.
We missed out a case here, we shouldn't had allowed the user to submit empty first name, this caused #44167.
Though i agree this is not actually a bug from this PR, but rather a missed logic.
There was a problem hiding this comment.
Thanks for pointing it out!



Details
Updates the display name validation to match the back-end. These are the changes:
maxLengthprop to first and last name fieldsFixed Issues
$ #13779
Tests
Offline tests
Same tests. Everything here should work while offline.
QA Steps
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.Screenshots/Videos
Web
Mobile Web - Chrome
Mobile Web - Safari
Desktop
iOS
Android