Repository navigation
[Hold for payment 2024-03-06] [$500] Workspace-The archived task report is no longer archived after reopening the report. #29049
Description
Activity
- addedExternalAdded to denote the issue can be worked on by a contributorAdded to denote the issue can be worked on by a contributorDailyKSv2KSv2BugSomething is broken. Auto assigns a BugZero manager.Something is broken. Auto assigns a BugZero manager.
on Oct 7, 2023 - changed the title
[-]Android-Workspace-The archived task report is no longer archived after reopening the report.[/-][+][$500] Android-Workspace-The archived task report is no longer archived after reopening the report.[/+]on Oct 7, 2023 Job added to Upwork: https://www.upwork.com/jobs/~019a5d1f4f0cd37991
Triggered auto assignment to @muttmuure (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.- addedHelp WantedApply this label when an issue is open to proposals by contributorsApply this label when an issue is open to proposals by contributors
on Oct 7, 2023 Bug0 Triage Checklist (Main S/O)
- This "bug" occurs on a supported platform (ensure
Platformsin OP are ✅) - This bug is not a duplicate report (check E/App issues and #expensify-bugs)
- If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
- This bug is reproducible using the reproduction steps in the OP. S/O
- If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
- If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
- This issue is filled out as thoroughly and clearly as possible
- Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
- I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync
- This "bug" occurs on a supported platform (ensure
Triggered auto assignment to Contributor-plus team member for initial proposal review - @mollfpr (
External)Proposal
Please re-state the problem that we are trying to solve in this issue.
Tasks that belong to an archived task report are still able to be completed/reopened
What is the root cause of that problem?
This actually seems to be a backend issue. This is evident due to the data coming from the API from the openReport call containing the property:
"isDeletedParentAction": false. The reason the title on the task is briefly correct [shows {TaskName} (Archived)] is due to optimistic updates. The task report is never actually archived.What changes do you think we should make in order to solve the problem?
Backend code needs to be checked for bugs regarding the calculation of the isDeletedParentAction prop in the context of an archived workspace.
If a patch for the frontend is needed in the meantime, a line could be added to
isDeletedParentActionwhich utilizes the persisted onyx store to look for the actionType "CLOSED" at the key for the report being opened.Proposal
Please re-state the problem that we are trying to solve in this issue.
The task report action in archived announce room is interactable and the task report is no longer archived after reopen the report
What is the root cause of that problem?
When we delete a workspace, we set the archived state of related reports here
App/src/libs/actions/Policy.js
Lines 93 to 102 in 389d7b0
..._.map(reports, ({reportID}) => ({ onyxMethod: Onyx.METHOD.MERGE, key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`, value: { stateNum: CONST.REPORT.STATE_NUM.SUBMITTED, statusNum: CONST.REPORT.STATUS.CLOSED, hasDraft: false, oldPolicyName: allPolicies[`${ONYXKEYS.COLLECTION.POLICY}${policyID}`].name, }, })),
Task report is marked as archived as well. But when we reopen the task report, the backend returnsstate: 0, status: 0again and so the task report returns to the normal state. This is one reasonAfter the workspace is deleted, we should disable the interaction of tasks. We disable the task using the below function
Lines 889 to 903 in 389d7b0
function canModifyTask(taskReport, sessionAccountID) { if (ReportUtils.isCanceledTaskReport(taskReport)) { return false; } if (sessionAccountID === getTaskOwnerAccountID(taskReport) || sessionAccountID === getTaskAssigneeAccountID(taskReport)) { return true; } // If you don't have access to the task report (maybe haven't opened it yet), check if you can access the parent report // - If the parent report is an #admins only room // - If you are a policy admin const parentReport = ReportUtils.getParentReport(taskReport); return ReportUtils.isAllowedToComment(parentReport); }
As you can see, we don't check if the parent report is an archived room. This is another reasonWhat changes do you think we should make in order to solve the problem?
This issue requires both the backend and frontend fixes
-
Backend
When a workspace is deleted, the backend should mark all the reports related to the workspacearchived -
Frontend
We need to update thecanModifyTaskfunction above to check the parent report
Update the above function as follows
function canModifyTask(taskReport, sessionAccountID) { if (ReportUtils.isCanceledTaskReport(taskReport)) { return false; } const parentReport = ReportUtils.getParentReport(taskReport); if (ReportUtils.isArchivedRoom(parentReport)) { return false; } if (sessionAccountID === getTaskOwnerAccountID(taskReport) || sessionAccountID === getTaskAssigneeAccountID(taskReport)) { return true; } // If you don't have access to the task report (maybe haven't opened it yet), check if you can access the parent report // - If the parent report is an #admins only room // - If you are a policy admin return ReportUtils.isAllowedToComment(parentReport); }This works as expected
What alternative solutions did you explore? (Optional)
-
Asking the internal team for the expected behavior of the task report when the parent report is archived.
93 remaining items
@mollfpr @muttmuure
PR is ready for review: #31674Reacted by Mohammad Luthfi Fathur RahmanAutomation looks not working. Pay day would be 6th, Mar here
- changed the title
[-][$500] Workspace-The archived task report is no longer archived after reopening the report.[/-][+][Hold for payment 2024-03-06] [$500] Workspace-The archived task report is no longer archived after reopening the report.[/+]on Feb 29, 2024 - addedAwaiting PaymentAuto-added when associated PR is deployed to productionAuto-added when associated PR is deployed to production
on Feb 29, 2024 Seems like this is fixed, issuing payment now
Sent new offer to @mollfpr since the original offer expired
@s-alves10 has been paid
[@mollfpr] The PR that introduced the bug has been identified. Link to the PR:
[@mollfpr] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:No offending PR was found. This is an improvement and need a backend change to fix the issue both ways.
[@mollfpr] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
The regression step should be good.
[@mollfpr] Determine if we should create a regression test for this bug.
[@mollfpr] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.- Open ND and log in with any account
- Go to announce room
- Create a task
- Delete the workspace in whose announce room the task is just created
- Note that the task report was archived in LHN
- Tap task in the archived announce room
- Verify that the task report remains archived and a user isn't able to tick the task to interact
- 👍 or 👎
@muttmuure I'll request in NewDot. Could you create the payment summary? Thank you!
$500 - @mollfpr C+
$500 approved for @mollfpr based on summary.
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Action Performed:
Expected Result:
In archived WS-announce room, user must not be able to tick the task and interact.
The archived task report must remain archived after reopening the report also.
Actual Result:
In archived WS-announce room, user able to tick the task and interact.
The archived task report is no longer archived after reopening the report.
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Version Number: 1.3.79-3
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation
Bug6228480_1696662427683.ree.mp4
Expensify/Expensify Issue URL:
Issue reported by: Applause-Internal Team
Slack conversation: @
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @muttmuure