-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Add violation message to MoneyRequestPreview #33969
Add violation message to MoneyRequestPreview #33969
Conversation
…o trevor-coleman/violations/32571-money-request-preview
…571-money-request-preview
…71-money-request-preview Trevor coleman/violations/32571 money request preview
…-preview # Conflicts: # src/libs/ReportUtils.ts # src/libs/SidebarUtils.ts # src/libs/TransactionUtils.ts # src/libs/ViolationsUtils.ts # src/types/onyx/index.ts # tests/perf-test/SidebarUtils.perf-test.ts
…o 32571-money-request-preview # Conflicts: # tests/perf-test/SidebarUtils.perf-test.ts
# Conflicts: # src/components/ReportActionItem/MoneyRequestPreview.js # src/components/ViolationMessages.tsx # src/libs/SidebarUtils.ts # src/libs/Violations/ViolationsUtils.ts # src/libs/__mocks__/Permissions.ts # tests/perf-test/SidebarUtils.perf-test.ts
…-preview # Conflicts: # src/CONST.ts # src/components/ReportActionItem/ReportPreview.js # src/pages/home/ReportScreen.js
@parasharrajat Please 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] |
@trevor-coleman I am not able to get the over-limit violation despite having the Control policy set up according to the instructions in the test steps. Screen.Recording.2024-02-15.at.21.33.11.mp4 |
@akinwale your account should have |
Which account are you using? I think @cead22 needs to enable violations for it in the back end. |
@trevor-coleman A couple of things I noticed from my testing (video included).
33969-web.mp4 |
This is a known issue outside the scope of this PR -- I believe it should be fixed when the optimistic update PR is merged.
The spec for this is:
The only violation shorter than 15 characters (in English) is |
I understand this part (for the preview). I was referring to the actual report itself, which is open after clicking the preview, but I realise that is out of scope here. Everything looks good! |
Awesome! Yeah the report itself is going to be fixed elsewhere -- right now it only updates when data is fetched from the server, but when the optimistiic updates stuff gets merged then we'll calculate them on the fly. |
Reviewer Checklist
Screenshots/VideosMacOS: Chrome / Safari33969-web.mp4 |
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.
src/languages/en.ts
Outdated
@@ -2303,8 +2303,8 @@ export default { | |||
overLimitAttendee: ({formattedLimit}: ViolationsOverLimitParams) => `Amount over ${formattedLimit}/person limit`, | |||
perDayLimit: ({formattedLimit}: ViolationsPerDayLimitParams) => `Amount over daily ${formattedLimit}/person category limit`, | |||
receiptNotSmartScanned: 'Receipt not verified. Please confirm accuracy.', | |||
receiptRequired: ({formattedLimit, category}: ViolationsReceiptRequiredParams = {}) => | |||
`Receipt required${formattedLimit ? ` over ${formattedLimit}${category ? ' category limit' : ''}` : ''}`, | |||
receiptRequired: (params: ViolationsReceiptRequiredParams) => `Receipt required${params ? ` over ${params.formattedLimit}${params.category ? ` category limit` : ''}` : ''}`, |
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.
Is there a reason for this change? I see we didn't make the same change in the es.ts file, can we undo this?
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.
We discussed it here: https://expensify.slack.com/archives/C01GTK53T8Q/p1704823942664409?thread_ts=1704302068.776969&cid=C01GTK53T8Q
I've updated them to be like this:
Params | English Translation | Spanish Translation |
---|---|---|
No params | Receipt required |
Recibo obligatorio |
{ formattedLimit: '$500' } |
Receipt required over $500 |
Recibo obligatorio para importes sobre $500 |
{ category: 'travel' } |
Receipt required over travel category limit |
Recibo obligatorio para importes sobre el límite de la categoría |
{ formattedLimit: '$500', category: 'travel' } |
Receipt required over $500 travel category limit |
Recibo obligatorio para importes sobre $500 el límite de la categoría |
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.
@trevor-coleman @cead22 Coming from this issue #44220 Can you confirm why we don't mention category name on the Spanish translation while we mention it on English translation? Are this intended? or we should fix it.
CC @abzokhattab
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.
We're not showing the category name in either case. We should say literally "category limit" or "límite de la categoría"
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.
We should say literally "category limit" or "límite de la categoría"
@cead22 is this mean the above table is not correct? because it showing the category name "travel" in English translation
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 think so. To be honest, I don't remember noticing the "travel" in "travel category limit" in there
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.
The above line use params
to check before showing word over
which display over undefined
if params = {formattedLimit: undefined, category: undefined}
and we fixed it here #44220
src/components/ReportActionItem/MoneyRequestPreview/MoneyRequestPreviewContent.tsx
Show resolved
Hide resolved
src/components/ReportActionItem/MoneyRequestPreview/MoneyRequestPreviewContent.tsx
Show resolved
Hide resolved
src/components/ReportActionItem/MoneyRequestPreview/MoneyRequestPreviewContent.tsx
Show resolved
Hide resolved
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 tested on desktop web and desktop native and it worked fine
✋ 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/cead22 in version: 1.4.43-0 🚀
|
🚀 Deployed to production by https://github.com/puneetlath in version: 1.4.43-20 🚀
|
Details
Adds a message to the MoneyRequestPreview that shows the violation or "Review Required"
Fixed Issues
$ #32571
Tests
Setup: Creating A Policy with Violations Test Cases
Turn on the Violations beta (or set
canUseViolations
to true)Go to OldDot and open or create a Control policy
Enable violations for the workspace in Settings > [Workspace] > Expenses
Make tags required for the policy
Go to Settings > [Workspace] > Tags
Enable "People must tag expenses"
Add a tag
5Enable the policy’s expense chat (reference link):
Go to the policy page
In the JS console with the policy open do:
Invite a new user to the policy
Sign into that new user account in New Dot
Go through the money request flow, choosing the policy you just created and create the following money requests:
Check that the correct message is displayed
Open the policy chat for the policy you created
Touch the Report Preview for the report that contains your money requests
The money requests should look as follows:
as
in screenshot. No violation message displayed
Offline tests
N/A - Should work as described above
QA Steps
Same as Testing steps above
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectionproduction API to ensure there are no regressions (e.g. long loading states that impact usability).
toggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and usingthe translation method
Link to Slack message: https://expensify.slack.com/archives/C01GTK53T8Q/p1704390940950099
the localization methods
should be capitalized), and is approved by marketing by adding the
Waiting for Copy
label 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 usingAvatar
are workingas expected)
i.e.
StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)blocks, quotes, headings, bold, strikethrough, and italic.
like
Avatar
is modified, I verified thatAvatar
is working as expected in all cases)out account.
Design
label so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop