-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Refactor the way of displaying errors in several forms #15978
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
Refactor the way of displaying errors in several forms #15978
Conversation
7e321a3 to
b3cf4cf
Compare
|
good point noticed by @ArekChr that since we operate on an object reference, we don't need to reassign the returned value to |
ArekChr
left a comment
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.
LGTM 👌
750651d to
9aace99
Compare
89e7d83 to
1b47492
Compare
|
@neil-marcellini @mollfpr 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] |
neil-marcellini
left a comment
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.
|
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
af3f32e to
b019c33
Compare
|
I have read the CLA Document and I hereby sign the CLA |
| roomAlreadyExistsError: 'A room with this name already exists', | ||
| roomNameReservedError: 'A room on this workspace already uses this name', | ||
| roomNameReservedError: 'Room names #admins and #announce are reserved names for this workspace', | ||
| roomNameInvalidError: 'Room names can only include lowercase letters, numbers and hyphens', |
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.
I followed your suggestion on reverting to two separate errors for restricted and existing room names and changed the roomNameReservedError message a little bit - I didn’t use the same pattern as in name’s containsReservedWord error message, because here we are checking for the exact #admins and #announce names and we are able to create a name including both words like e.g. #ck-admins. (Or maybe we should change the validation here?) If it doesn’t sound ok or you have an idea for a different message, please let me know, I’ll change it.
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, looks pretty good. From what I read in Slack I think from we want an error message for each default room name. We can use a translation function like this to achieve that.
Line 64 in bb8dff1
| addressLine: ({lineNumber}) => `Address line ${lineNumber}`, |
#admins is a default room on all workspaces. Please choose another name.
#announce is a default room on all workspaces. Please choose another name.
neil-marcellini
left a comment
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. We need to update the copy and I think there's also still the birth date issue. After that it's good to go!
|
So as we discussed in this thread: https://expensify.slack.com/archives/C01GTK53T8Q/p1679309038849709 I've changed the roomNameReservedError to the message suggested by Neil. for now it looks like this and works for creating new room and updating the existing one. |
|
@neil-marcellini Regarding the issue with date - should it be handled like here: on the personal details date of birth page? |
Yes, except the date format in the error message doesn't match, so we should fix that! There's so many little problems with these error messages. |
|
@neil-marcellini I've fixed the issue with displaying two error messages. I've also noticed that we have a new date picker implemented by Arek on DOB page (PR) which has an yyyy-mm-dd format for all the platforms. The old date picker which is still used in some forms has a proper yyyy-mm-dd format for iOS and Android, for the web it has dd/mm/yyyy format. So maybe we could use the old error messages (like on the screenshots) for now for the old date pickers until they are changed for the new one? We also have a different minimal age requirement for the DOB in personal details (5) and the rest of the DOB pickers (18). Please let me know if we can leave it for now as it is or we should think of another solution. |
|
@koko57 Ah ok, thanks for the research an explanation. That sounds good to me. |
neil-marcellini
left a comment
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.
Please update the QA steps for the room name to ask the user to sign into an expensifail.com account, since those accounts are on the defaultRooms beta and we can't modify the code during QA.
Other than that it tests well and the code looks great. Thanks!
|
@mollfpr please review complete the checklist when you have time. |
|
@neil-marcellini On it, thanks for the ping! |
Reviewer Checklist
Screenshots/VideosWeb15978.Web.-.Enable.payment.mov15978.Web.-.Display.name.mov15978.Web.-.Room.movMobile Web - Chrome15978.mWeb-Chrome.-.Room.mp415978.mWeb-Chrome.-.Display.name.mp415978.mWeb-Chrome.-.Enable.payment.mp4Mobile Web - Safari15978.mWeb-Safari.-.Room.mp415978.mWeb-Safari.-.Display.name.mp415978.mWeb-Safari.-.Enable.payment.mp4Desktop15978.Desktop.-.Room.mp415978.Desktop.-.Display.name.mp415978.Desktop.-.Enable.payment.mp4iOS15978.iOS.-.Room.mp415978.iOS.-.Display.name.mp415978.iOS.-.Enable.payment.mp4Android15978.Android.-.Display.name.mp415978.Android.-.Room.mp415978.Android.-.Enable.payment.mp4 |
mollfpr
left a comment
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.
Good work on this PR @koko57 👍
We just need to add the test for the display name form to the test step and we are good to go 🚀
|
We didn't really change much in relation to the display name page so I'm going to go ahead and merge this. Thanks everyone! |
|
✋ 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/neil-marcellini in version: 1.2.89-0 🚀
|
|
🚀 Deployed to production by https://github.com/luacmartins in version: 1.2.89-0 🚀
|








Details
This PR implements displaying multiple error messages in forms where applicable and refactoring the validation conditions in several forms to avoid displaying errors that does not make sense together.
Fixed Issues
$ #15156
PROPOSAL: #15156 (comment)
Tests
/settings/payments/enable-paymentspageTo do the next tests, change in
src/libs/Permissions.jsis needed. In line :78 (canUsePolicyRoomsfunction) change it toreturn true;test,and blur from the inputOffline tests
n/a
QA Steps
/settings/payments/enable-paymentspageTo do the next tests, change in
src/libs/Permissions.jsis needed. In line :78 (canUsePolicyRoomsfunction) change it toreturn true;test,and blur from the inputPR 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.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Web
WEB.mov
Mobile Web - Chrome
ANDROID.WEB.mov
Mobile Web - Safari
iOS.WEB.mov
Desktop
DESKTOP.mov
iOS
iOS.mov
Android
ANDROID.mov