-
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
[HOLD for payment 2024-07-24] [$250] QBO - "Required" remains enabled when all tags are disabled #43666
Comments
Triggered auto assignment to @cead22 ( |
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
|
@cead22 FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors |
Job added to Upwork: https://www.upwork.com/jobs/~01f4ad944ec831b5b7 |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @akinwale ( |
ProposalPlease re-state the problem that we are trying to solve in this issue."Required" remains enabled when all tags are disabled What is the root cause of that problem?We don't implement the logic to toggle off What changes do you think we should make in order to solve the problem?When the disableTag button is clicked, we must verify if all tags are currently disabled. App/src/pages/workspace/tags/WorkspaceViewTagsPage.tsx Lines 176 to 179 in 595967d
If if all tags are currently disabled, we need to turn off
Bonus point 1: Also consider toggling off Bonus point 2: Also consider toggling on What alternative solutions did you explore? (Optional) |
ProposalPlease re-state the problem that we are trying to solve in this issue.QBO - "Required" remains enabled when all tags are disabled What is the root cause of that problem?We don't update the required state of the tag list based on numbers enabled/disabled tags. App/src/libs/actions/Policy/Tag.ts Line 181 in 595967d
What changes do you think we should make in order to solve the problem?We should handle it the same way we do with categories. App/src/libs/actions/Policy/Category.ts Lines 148 to 256 in 595967d
Pseudo codefunction setWorkspaceTagEnabled(policyID: string, tagsToUpdate: Record<string, {name: string; enabled: boolean}>, tagListIndex: number) {
const policyTag = PolicyUtils.getTagLists(allPolicyTags?.[`${ONYXKEYS.COLLECTION.POLICY_TAGS}${policyID}`] ?? {})?.[tagListIndex] ?? {};
const optimisticPolicyTagsData = {
...Object.keys(tagsToUpdate).reduce<PolicyTags>((acc, key) => {
acc[key] = {
...policyTag.tags[key],
...tagsToUpdate[key],
errors: null,
pendingFields: {
enabled: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE,
},
pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE,
};
return acc;
}, {}),
};
const shouldDisableRequiresTag = !OptionsListUtils.hasEnabledOptions({...policyTag.tags, ...optimisticPolicyTagsData});
const onyxData: OnyxData = {
optimisticData: [
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.POLICY_TAGS}${policyID}`,
value: {
[policyTag.name]: {
...(shouldDisableRequiresTag ? {required: false, pendingFields: {required: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE}, errorFields: {required: null}} : {}),
tags: optimisticPolicyTagsData,
},
},
},
],
successData: [
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.POLICY_TAGS}${policyID}`,
value: {
[policyTag.name]: {
tags: {
...(shouldDisableRequiresTag ? {pendingFields: {required: null}} : {}),
...Object.keys(tagsToUpdate).reduce<PolicyTags>((acc, key) => {
acc[key] = {
...policyTag.tags[key],
...tagsToUpdate[key],
errors: null,
pendingFields: {
enabled: null,
},
pendingAction: null,
};
return acc;
}, {}),
},
},
},
},
],
failureData: [
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.POLICY_TAGS}${policyID}`,
value: {
[policyTag.name]: {
tags: {
...(shouldDisableRequiresTag ? {pendingFields: {required: null}, required: policyTag.required} : {}),
...Object.keys(tagsToUpdate).reduce<PolicyTags>((acc, key) => {
acc[key] = {
...policyTag.tags[key],
...tagsToUpdate[key],
errors: ErrorUtils.getMicroSecondOnyxError('workspace.tags.genericFailureMessage'),
pendingFields: {
enabled: null,
},
pendingAction: null,
};
return acc;
}, {}),
},
},
},
},
],
};
const parameters: SetPolicyTagsEnabled = {
policyID,
tags: JSON.stringify(Object.keys(tagsToUpdate).map((key) => tagsToUpdate[key])),
tagListIndex,
};
API.write(WRITE_COMMANDS.SET_POLICY_TAGS_ENABLED, parameters, onyxData);
} What alternative solutions did you explore? (Optional)ResultMonosnap.screencast.2024-06-13.23-51-46.mp4 |
@Krishna2323's proposal works here since it follows the same method of an already existing implementation for categories. 🎀👀🎀 C+ reviewed. |
Current assignee @cead22 is eligible for the choreEngineerContributorManagement assigner, not assigning anyone new. |
📣 @akinwale 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app! |
📣 @Krishna2323 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app! Offer link |
@akinwale, PR ready for review. |
This issue has not been updated in over 15 days. @cead22, @akinwale, @Krishna2323 eroding to Monthly issue. P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do! |
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.7-8 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue: If no regressions arise, payment will be issued on 2024-07-24. 🎊 For reference, here are some details about the assignees on this issue:
|
Issue is ready for payment but no BZ is assigned. @dylanexpensify you are the lucky winner! Please verify the payment summary looks correct and complete the checklist. Thanks! |
@cead22, @akinwale, @dylanexpensify, @Krishna2323 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues! |
Contributor: @Krishna2323 paid $250 via Upwork @akinwale plz complete the BZ checklist below? BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
|
Not a regression. The specific functionality was not implemented.
Regression Test Steps
Do we agree 👍 or 👎? |
Thanks @akinwale , test case created! |
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Version Number: 1.4.83-0
Reproducible in staging?: Y
Reproducible in production?: N
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Issue reported by: Applause - Internal Team
Issue found when executing PR #42972
Action Performed:
Precondition:
Expected Result:
"Required" will be disabled and locked when all tags are disabled (same behavior when all categories are disabled)
Actual Result:
"Required" remains enabled when all tags are disabled
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
Bug6512016_1718287352585.20240613_215711.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @akinwaleThe text was updated successfully, but these errors were encountered: