Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
3.34k stars 2.77k forks source link

Task - Unassigned user can mark a task as incomplete #49301

Closed IuliiaHerets closed 16 hours ago

IuliiaHerets commented 2 days ago

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: v9.0.36-0 Reproducible in staging?: Y Reproducible in production?: Y Issue was found when executing this PR: https://github.com/Expensify/App/pull/47519 Email or phone of affected tester (no customers): natnael.expensify+3@gmail.com Issue reported by: Applause Internal Team

Action Performed:

  1. [User A] Go to a DM with user B
  2. [User A] Assign task to yourself
  3. [User A] Mark it as complete
  4. [User B] Open the task detail report
  5. [User B] Click on header
  6. [User B] Click Mark as incomplete button

Expected Result:

There shouldn't be 'Mark as complete button'

Actual Result:

Task is marked as uncompleted

Workaround:

Unknown

Platforms:

Screenshots/Videos

https://github.com/user-attachments/assets/0b35dd29-e6c3-41d3-bf51-115f0be170ee

View all open jobs on GitHub

melvin-bot[bot] commented 2 days ago

Triggered auto assignment to @CortneyOfstad (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

IuliiaHerets commented 2 days ago

@CortneyOfstad 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

etCoderDysto commented 2 days ago

Proposal

Please re-state the problem that we are trying to solve in this issue.

Task - Unassigned user can mark a task as incomplete

What is the root cause of that problem?

In ReportDetails page, we are not checking if the current user is assignee or task owner before we are adding mark as incomplete action to menuItems https://github.com/Expensify/App/blob/6eb93964edb5e0013a4ee26331a0f619aba59f3f/src/pages/ReportDetailsPage.tsx#L369-L374

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

We should check if the user is task assignee or task owner using Task.canActionTask https://github.com/Expensify/App/blob/6eb93964edb5e0013a4ee26331a0f619aba59f3f/src/libs/actions/Task.ts#L1154-L1158

const canActionTask = Task.canActionTask(report, session?.accountID ?? -1);
 if (ReportUtils.isCompletedTaskReport(report) && canModifyTask && canActionTask)

What alternative solutions did you explore? (Optional)

Krishna2323 commented 2 days ago

Proposal


Please re-state the problem that we are trying to solve in this issue.

What is the root cause of that problem?

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


What alternative solutions did you explore? (Optional)

Result

CortneyOfstad commented 16 hours ago

We need to have a fall back in case a task is marked as complete by accident, giving someone the ability undo that (i.e. mark as incomplete).

The second person should have this option (especially if they are an admin on the default workspace), which these instructions are missing as a pre-requisite or not.

Closing!