Implementing optimistic violations for workspace categories and tags.#62627
Implementing optimistic violations for workspace categories and tags.#62627cead22 merged 145 commits intoExpensify:mainfrom
Conversation
|
@mananjadhav 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] |
|
Reviewing the previous PR. Once done, will get to this as the changes are similar. |
|
Thanks @Tony-MK for the updates. I was just about to comment on this one. I'll be taking a look at this today. Quick thing, I can see conflicts and the recent commits as Unverified. Can you please fix those? |
|
Let me fix the conflicts. Just merged it with my tests branch. |
|
Thanks. And as I mentioned, please check the unverified commits as well. Apologies for the delay here, I was out for a few days last week. Will get to this today. |
situchan
left a comment
There was a problem hiding this comment.
Please address above comments
@situchan, Please check |
@Tony-MK I don't follow what you're saying. Just update as I suggested.
yes, I know. That's why Test Case should be updated to match the current behavior (not expected behavior as will be done as follow-up). Make sense? With current test cases, QA will fail on Step 14. How come category violation will not be visible if change the expense's category to anything? |
Because the expense's tag is updated to a valid tag from an invalid one. |
Ah you meant to update expense category. I thought to add new category in setting with the same name. |
|
ok then only #62627 (comment) and #62627 (comment) are to be resolved |
Yeah, I mentioned this type of scenario to Carlos. It seemed like an edge case for other PR.
This depends on whether the user navigates away from the report or refreshes the report. Repro.2.movSince the realistic violations sent by the
Repro.1.mov |
|
ok so there should be reasonable explanations for whatever QA team reports. Btw, there's conflict. |
…y-App into tags-violations
|
@Tony-MK since this is large PR which touched many files, let's be on a look out for any blockers QA found on staging. |
|
@Tony-MK Sorry for the trouble, after the revert the issue prevailed so its not directly related. Can you please remake the PR? |

Explanation of Change
Created a new hook
usePolicyDatato fetch the policy categories, tags, and reports with their associated transactions and violations.policyDatais used in the functions listed below to make them pure and optimistically show violations when the categories or tags used by expenses have changed./actions/ReportUtils.tspushTransactionViolationsOnyxData()/actions/Policy/Tag.tssetWorkspaceTagEnabled()setWorkspaceTagRequired()deletePolicyTags()enablePolicyTags()renamePolicyTag()setPolicyRequiresTag()setPolicyTagsRequired()/actions/Policy/Category.tsdeleteWorkspaceCategories()enablePolicyCategories()renamePolicyCategory()removePolicyCategoryReceiptsRequired()setPolicyCategoryReceiptsRequired()setWorkspaceCategoryEnabled()setWorkspaceRequiresCategory()Fixed Issues
$ #62698
PROPOSAL:
Tests
Prerequisite for Test Cases 1 - 5: A
Must tag expensesenabled workspaceTest Case 1: Enable and Disable Tag Feature
Missing Tagviolation on the report preview is visible.Missing Tagviolation in the expense thread is visible.Force Offline.Missing Tagviolation on the report preview is not visible.Missing Tagviolation in the expense thread is not visible.Force Offline.Missing Tagviolation on the report preview is not visible.Missing Tagviolation in the expense thread is not visible.Force Offline.Missing Tagviolation on the report preview is not visible.Missing Tagviolation in the expense thread is not visible.Force Offline.Missing Tagviolation on the report preview is not visible.Missing Tagviolation in the expense thread is not visible.Test Case 2: Enable and Disable Tag Requirement
Missing Tagviolation is visible.Force Offline.Must tag expensessetting.Missing Tagviolation is not visible.Force Offline.Force Offline.Must tag expenses.Missing Tagviolation is visible.Force Offline.Test Case 3: Enable and Disable Tag
Force Offline.Tag no longer validviolation is visible.Force Offline.Force Offline.Force Offline.Test Case 4: Delete and Update Tag
Force Offline.Tag no longer validviolation is visible.Force Offline.Force Offline.Force Offline.Test Case 5: Rename Tag
Force Offline.Tag no longer validviolation is visible.Force Offline.Force Offline.Force Offline.Prerequisite for Test Cases 6 - 11: A
Must category expensesenabled workspaceTest Case 6: Enable and Disable Category Feature
Missing Categoryviolation on the report preview is visible.Missing Categoryviolation in the expense thread is visible.Force Offline.Missing Categoryviolation on the report preview is not visible.Missing Categoryviolation in the expense thread is not visible.Force Offline.Missing Categoryviolation on the report preview is not visible.Missing Categoryviolation in the expense thread is not visible.Force Offline.Missing Categoryviolation on the report preview is not visible.Missing Categoryviolation in the expense thread is not visible.Force Offline.Missing Categoryviolation on the report preview is not visible.Missing Categoryviolation in the expense thread is not visible.Test Case 7: Enable and Disable Category Requirement
Missing Categoryviolation is visible.Force Offline.Must category expensessetting.Missing Categoryviolation is not visible.Force Offline.Force Offline.Must category expenses.Missing Categoryviolation is visible.Force Offline.Test Case 8: Enable and Disable Category
Force Offline.Category no longer validviolation is visible.Force Offline.Force Offline.Force Offline.Test Case 9: Delete Category and Update Expense Category
Force Offline.Category no longer validviolation is visible.Force Offline.Force Offline.Force Offline.Test Case 10: Rename Category
Force Offline.Category no longer validviolation is visible.Force Offline.Force Offline.Force Offline.Test Case 11: Set Receipt Required Amount Rule
RulesFeature.Receipt Required Amountwith a random amount value.Receipt Required Amount.Force Offline.Require receipts overto "Always require receipts".Receipt Requiredviolation is visible.Force Offline.Force Offline.Require receipts overto "Never require receipts".Force Offline.Force Offline.Require receipts overto the initial default value.Force Offline.Offline tests
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
Same as tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso 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
Test Case 1: Tag Feature
Test Case 2: Tag Requirement
Test Case 3: Enable and Disable Tag
Test Case 4: Delete and Update Tag
Android.-.Native.mov
Test Case 5: Rename Tag
Test Case 6: Category Feature
Test Case 7: Category Requirement
Test Case 8: Enable and Disable Category
Test Case 9: Delete and Update Category
Test Case 10: Rename Category
Test Case 11: Set Receipt Required Amount Rule
Android: mWeb Chrome
Test Case 1: Tag Feature
Tag.Feature.webm
Test Case 2: Tag Requirement
Tag.Requirement.webm
Test Case 3: Enable and Disable Tag
Tag.Enable.Disable.webm
Test Case 4: Delete and Update Tag
Tag.Delete.Update.webm
Test Case 5: Rename Tag
Tag.Rename.webm
Test Case 6: Category Feature
Category.Feature.webm
Test Case 7: Category Requirement
Category.Requirement.webm
Test Case 8: Enable and Disable Category
Category.Enable.Disable.webm
Test Case 9: Delete and Update Category
Category.Delete.Update.webm
Test Case 10: Rename Category
Category.Rename.webm
Test Case 11: Set Receipt Required Amount Rule
Category.Receipt.webm
iOS: Native
Test Case 1: Tag Feature
Tag.Feature.mp4
Test Case 2: Tag Requirement
Tag.Requirement.mp4
Test Case 3: Enable and Disable Tag
Tag.Enable.DIsable.mp4
Test Case 4: Delete and Update Tag
Tag.Delete.Update.mp4
Test Case 5: Rename Tag
Tag.Rename.mp4
Test Case 6: Category Feature
Category.Feature.mp4
Test Case 7: Category Requirement
Category.Requirement.mov
Test Case 8: Enable and Disable Category
Category.Enable.Disable.mp4
Test Case 9: Delete and Update Category
Category.Delete.Update.mp4
Test Case 10: Rename Category
Category.Rename.mp4
Test Case 11: Set Receipt Required Amount Rule
Category.Receipt.mp4
iOS: mWeb Safari
Test Case 1: Tag Feature
Tag.Feature.mp4
Test Case 2: Tag Requirement
Tag.Requirement.mp4
Test Case 3: Enable and Disable Tag
Tag.Enable.Disable.mp4
Test Case 4: Delete and Update Tag
Tag.Delete.Update.mp4
Test Case 5: Rename Tag
Tag.Rename.mp4
Test Case 6: Category Feature
Category.Feature.mp4
Test Case 7: Category Requirement
Category.Requirement.mp4
Test Case 8: Enable and Disable Category
Category.Enable.Disable.mp4
Test Case 9: Delete and Update Category
Category.Delete.Update.mp4
Test Case 10: Rename Category
Category.Rename.mp4
Test Case 11: Set Receipt Required Amount Rule
Category.Receipt.mp4
MacOS: Chrome / Safari
Test Case 1: Tag Feature
Tag.Feature.mov
Test Case 2: Tag Requirement
Enable.Disable.Requirement.mov
Test Case 3: Enable and Disable Tag
Enable.Disable.Tag.mov
Test Case 4: Delete and Update Tag
Tag.Delete.Update.mov
Test Case 5: Tag Rename
Tag.Rename.mov
Test Case 6: Category Feature
Category.Feature.mov
Test Case 7: Category Requirement
Category.Requirement.mov
Test Case 8: Enable and Disable Category
Category.Enable.Disable.mov
Test Case 9: Delete and Update Category
Catergory.Delete.Update.mov
Test Case 10: Rename Category
Category.Rename.mov
Test Case 11: Set Receipt Required Amount Rule
Category.Receipt.mov
MacOS: Desktop
Test Case 1: Tag Feature
Tag.Feature.mov
Test Case 2: Tag Requirement
Tag.Reqirement.mov
Test Case 3: Enable and Disable Tag
Enable.and.Disabled.Tag.mov
Test Case 4: Delete and Update Tag
Delete.and.Update.Tags.mov
Test Case 5: Rename Tag
Rename.Tag.mov
Test Case 6: Category Feature
Catergory.Feature.mov
Test Case 7: Category Requirement
Category.Requirement.mov
Test Case 8: Enable and Disable Category
Category.Enable.Disable.mov
Test Case 9: Delete and Update Category
Category.Delete.and.Update.mov
Test Case 10: Rename Category
Category.Rename.mov
Test Case 11: Set Receipt Required Amount Rule
Category.Receipt.Amount.mov