Skip to content

[Hold for payment 2024-03-06] [$500] Workspace-The archived task report is no longer archived after reopening the report. #29049

Description

@izarutskaya

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:

  1. Launch app
  2. Tap announce room
  3. Tap plus icon
  4. Select assign task
  5. Enter title "Ree task" and tap next
  6. Tap confirm task
  7. Navigate back to LHN
  8. Tap profile
  9. Tap Workspaces
  10. Select the Workspace(in whose announce room task is created)
  11. Tap on 3dots on top and delete the workspace
  12. Navigate to LHN and note the created task( " Ree Task") is archived
  13. Tap on archived Workspace and confirm Workspace is archived
  14. Open the archived announce room
  15. Tap on the task and note the task report header
  16. Tap back and tick the task
  17. Tap on the task again and note the task report header

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?

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

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
  • Upwork Job URL: https://www.upwork.com/jobs/~019a5d1f4f0cd37991
  • Upwork Job ID: 1710593181054087168
  • Last Price Increase: 2023-11-20
  • Automatic offers:
    • mollfpr | Reviewer | 27773918
    • s-alves10 | Contributor | 27773920
Issue OwnerCurrent Issue Owner: @muttmuure

Activity

  1. added
    ExternalAdded to denote the issue can be worked on by a contributor
    BugSomething is broken. Auto assigns a BugZero manager.
    on Oct 7, 2023
  2. 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
  3. melvin-bot commented on Oct 7, 2023

    @melvin-bot
  4. melvin-bot commented on Oct 7, 2023

    @melvin-bot

    Triggered auto assignment to @muttmuure (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

  5. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Oct 7, 2023
  6. melvin-bot commented on Oct 7, 2023

    @melvin-bot

    Bug0 Triage Checklist (Main S/O)

    • This "bug" occurs on a supported platform (ensure Platforms in 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
  7. melvin-bot commented on Oct 7, 2023

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @mollfpr (External)

  8. graylewis commented on Oct 7, 2023

    @graylewis
    Contributor

    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 isDeletedParentAction which utilizes the persisted onyx store to look for the actionType "CLOSED" at the key for the report being opened.

  9. dummy-1111 commented on Oct 7, 2023

    @dummy-1111
    Contributor

    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

    ..._.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 returns state: 0, status: 0 again and so the task report returns to the normal state. This is one reason

    After the workspace is deleted, we should disable the interaction of tasks. We disable the task using the below function

    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 reason

    What changes do you think we should make in order to solve the problem?

    This issue requires both the backend and frontend fixes

    1. Backend
      When a workspace is deleted, the backend should mark all the reports related to the workspace archived

    2. Frontend
      We need to update the canModifyTask function 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)

  10. mollfpr commented on Oct 9, 2023

    @mollfpr
    Contributor

    Asking the internal team for the expected behavior of the task report when the parent report is archived.

  11. 93 remaining items

  12. dummy-1111 commented on Feb 15, 2024

    @dummy-1111
    Contributor

    @mollfpr @muttmuure
    PR is ready for review: #31674

  13. dummy-1111 commented on Feb 29, 2024

    @dummy-1111
    Contributor

    @pecanoro

    Automation looks not working. Pay day would be 6th, Mar here

  14. 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
  15. muttmuure commented on Mar 7, 2024

    @muttmuure
    Contributor

    Seems like this is fixed, issuing payment now

  16. muttmuure commented on Mar 7, 2024

    @muttmuure
    Contributor

    Sent new offer to @mollfpr since the original offer expired

  17. muttmuure commented on Mar 7, 2024

    @muttmuure
    Contributor

    @s-alves10 has been paid

  18. mollfpr commented on Mar 9, 2024

    @mollfpr
    Contributor

    [@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.

    1. Open ND and log in with any account
    2. Go to announce room
    3. Create a task
    4. Delete the workspace in whose announce room the task is just created
    5. Note that the task report was archived in LHN
    6. Tap task in the archived announce room
    7. Verify that the task report remains archived and a user isn't able to tick the task to interact
    8. 👍 or 👎

    @muttmuure I'll request in NewDot. Could you create the payment summary? Thank you!

  19. muttmuure commented on Mar 12, 2024

    @muttmuure
    Contributor

    $500 - @mollfpr C+

  20. JmillsExpensify commented on Mar 13, 2024

    @JmillsExpensify
    Contributor

    $500 approved for @mollfpr based on summary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2EngineeringExternalAdded to denote the issue can be worked on by a contributorInternalRequires API changes or must be handled by Expensify staffReviewingHas a PR in review

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions