Use error prop for violations for consistent styling#34303
Conversation
…s into errors prop of inputs
…and update brickRoadIndicatorProps
…o 32594-update-style-for-violations
…for-violations # Conflicts: # src/components/ReportActionItem/MoneyRequestView.js # src/libs/ReportUtils.ts # src/libs/SidebarUtils.ts # src/pages/home/sidebar/SidebarLinksData.js
…for-violations # Conflicts: # src/libs/ReportUtils.ts # src/libs/SidebarUtils.ts
|
@dubielzyk-expensify @cubuspl42 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] |
|
@cead22 -- This is ready to go! |
|
Merged in latest main and it seems to have fixed the failing performance test. |
|
I think it's possible everything is working correctly, but if you can share the workspace IDs you're using, and maybe more specifically what you think it's not working, I can confirm. For the things that look strange there
|
|
I don't want to block this PR. I'll go through all the tests and let you decide whether the videos' results are correct. |
|
Feel free to ask any questions and I'll be happy to add clarity where I can, I know there's a lot of moving parts and some non-obvious things like implicit categorization that makes things confusing |
|
Awesome! Glad we got all that sorted. Let me look into the scanning one. |
Yes, when users input the data being scanned manually, the request looks like it's not scanning, but I believe we continue the scan in the background. Is the violation showing now?
Can you share more details about this, are you pointing to a specific error or problem with the PR? Sorry if I'm missing something obvious, I'm just trying to figure out if things are working correctly, and so far it seems like they are |
|
I think I've figured it out -- the That I've removed section D from the test instructions, and I think we are now passing all tests. Just need to merge in main to fix the lint error and we are good. |
|
Awesome sauce! |
|
Main is merged, and now comes the time of anxious waiting for the CI checks to complete. |
|
Am I crazy or is the check for the reviewer checklist missing? |
situchan
left a comment
There was a problem hiding this comment.
(just for testing checks)
Is reviewer checklist missing
Reviewer Checklist
Screenshots/VideosAndroid: Nativeviolations-android-compressed.mp4Android: mWeb Chromeviolations-android-web-compressed.mp4iOS: Nativeviolations-ios-compressed.mp4iOS: mWeb Safariviolations-ios-web-compressed.mp4MacOS: Chrome / SafariA. a-first-money-request.mp4B. b-changes-to-show-category-violations.mp4C. c-changes-to-clear-violations.mp4 |
…for-violations # Conflicts: # src/components/ReportActionItem/MoneyRequestView.tsx
|
Merged main and resovled conflict. |
|
So close! |
|
Yeah I just wanted to test dekstop becasue I didn't see screenshots/videos in the reviewer checklist. I added them now |
|
✋ 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 production by https://github.com/thienlnam in version: 1.4.41-12 🚀
|






Details
Initially error messages for violations were added as a component under the input. This resulted in odd spacing and behaviour inconsistent with other inputs in the application.
This PR moves the error messages into the
errorprop of the input where it is available.Because the logic for seelcting which error message to display was getting complicated, I gathered it into a
getErrorForFieldfunction.I also included the fix for #34773 since it was small and related.
Important
Due to an issue outside the scope of this PR, violations will not appear immediately on some fields.
To get them to update you will need to browse away from the
MoneyRequestViewand back, as that will trigger the necessary update.This issue should be solved soon -- it may even be solved before you read this! So if all the expected violations appear immediately in your tests, you can to safely ignore the instructions to browse away and back.
Fixed Issues
$ #33527
$ #34773
Tests
Create a workspace and enable violations for the policy.
Important
All accounts used in this test need to have the Violations beta enabled in the back end in order to receive the correct violations. Ask @cead22 if you need to get accounts added to the beta.
Turn on the Violations beta (or set
canUseViolationsto true)Go to OldDot and open or create a Control policy
Enable violations for the workspace in Settings > [Workspace] > Expenses
Set up requirements that will a violation on every field:
Enable the policy’s expense chat:
Go to the policy page
In the JS console with the policy open do:
Invite an employee to the policy
Return to New Dot
Sign into the employee account you just added to the policy
A. First Money Request
As the employee go through the money request flow, create the following money request under that policy:
Request 1
Click another option in the LHN, then browse back to the
MoneyRequestViewand and check that the errors in the table below are shown.Note
A refresh alone will not be enough to get the violations to appear. You will need to browse to another chat and then back to the money request to get the violations to show. (Local processing for violations is being added in a separate PR).
(note: "0 days" is a backend bug, but an issue has been opened to address it)
B. Changes to show category violations
Update the money to:
Click another option in the LHN, then browse back to
MoneyRequestViewand check that the errors in the table below are shown.Note
Violations will not show until you browse away and come back.
Note
Errors from previous step will still be visible.
C. Changes to clear violations
Update the money to:
Click another option in the LHN, then browse back to the
MoneyRequestViewand check that violation messages are NOT shown onamount,category,description, andtagfields.Note
Violations will not be cleared until you browse away and come back.
Note
The receipt field will still show a violation.
Offline tests
This will not work offline yet, as we are waiting for local processing of violations to be added in a separate PR.
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionproduction API to ensure there are no regressions (e.g. long loading states that impact usability).
toggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and usingthe translation method
Link to Slack message:
the localization methods
should be capitalized), and is approved by marketing by adding the
Waiting for Copylabel for a copy review on the original GH to get the correct copy.index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
STYLE.md) were followedAvatar, I verified the components usingAvatarare workingas expected)
i.e.
StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))blocks, quotes, headings, bold, strikethrough, and italic.
like
Avataris modified, I verified thatAvataris working as expected in all cases)out account.
Designlabel so the design team can review the changes.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
Android: Native
A. First Money Request

B. Changes to show category violations

C. Changes to clear violations

D. Check receipt violations

Android: mWeb Chrome
A. First Money Request

B. Changes to show category violations

C. Changes to clear violations

D. Check receipt violations

iOS: Native
A. First Money Request

B. Changes to show category violations

C. Changes to clear violations

D. Check receipt violations

iOS: mWeb Safari
A. First Money Request

B. Changes to show category violations

C. Changes to clear violations

D. Check receipt violations

MacOS: Chrome / Safari
A. First Money Request

B. Changes to show category violations

C. Changes to clear violations

D. Check receipt violations

MacOS: Desktop
A. First Money Request

B. Changes to show category violations

C. Changes to clear violations

D. Check receipt violations
