Skip to content
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-02-14] [$500] Task – Able to edit task as room's member but not a member of Workspace #33420

Closed
3 of 6 tasks
kbecciv opened this issue Dec 21, 2023 · 81 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor

Comments

@kbecciv
Copy link

kbecciv commented Dec 21, 2023

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: v1.4.15-4
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
Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal team
Slack conversation:

Action Performed:

  1. Go to https://staging.new.expensify.com/
  2. Log in
  3. Navigate to a Room Chat that has 2 or more participants
  4. Click on the + in the compose box and select "Assign task"
  5. Enter a Title only
  6. Create the task
  7. Log in as another participant of the #Room
  8. Navigate to the #Room conversation where the task was created
  9. Verify that user B can't edit task
  10. Log in as another participant of the #Room who is not a member of Workspace
  11. Navigate to the #Room conversation where the task was created
  12. Click on Assignee

Expected Result:

Able to edit task as room's member but not a member of Workspace

Actual Result:

Room's member but not a member of Workspace can't edit task

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6322845_1703172828811.Room_task.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0118689f6671de101d
  • Upwork Job ID: 1737861669620363264
  • Last Price Increase: 2024-01-18
  • Automatic offers:
    • aimane-chnaif | Reviewer | 28121679
    • DylanDylann | Contributor | 28121680
@kbecciv kbecciv added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Dec 21, 2023
@melvin-bot melvin-bot bot changed the title Task – Able to edit task as room's member but not a member of Workspace [$500] Task – Able to edit task as room's member but not a member of Workspace Dec 21, 2023
Copy link

melvin-bot bot commented Dec 21, 2023

Job added to Upwork: https://www.upwork.com/jobs/~0118689f6671de101d

Copy link

melvin-bot bot commented Dec 21, 2023

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Dec 21, 2023
Copy link

melvin-bot bot commented Dec 21, 2023

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

Copy link

melvin-bot bot commented Dec 21, 2023

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

@namhihi237
Copy link
Contributor

namhihi237 commented Dec 21, 2023

Proposal

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

Users in the same room can not modify the task

What is the root cause of that problem?

This issue come from here.
we only allow the user as an admin can modify task in the room here and if the user is a member of the WS we don't allow modification, but if the user is not in the WS the policyRole is empty so they can modify the task.

if (policyRole && (ReportUtils.isChatRoom(parentReport) || ReportUtils.isPolicyExpenseChat(parentReport)) && policyRole !== CONST.POLICY.ROLE.ADMIN) {
return false;
}

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

We should remove this logic to allow all member edit the task

if (policyRole && (ReportUtils.isChatRoom(parentReport) || ReportUtils.isPolicyExpenseChat(parentReport)) && policyRole !== CONST.POLICY.ROLE.ADMIN) {
return false;
}

Also we revert this PR

What alternative solutions did you explore? (Optional)

@unidev727
Copy link
Contributor

unidev727 commented Dec 21, 2023

Proposal

from: @unicorndev-727

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

Users in the same room can not modify the task

What is the root cause of that problem?

The root cause is that we don't check if the users are the room member in chatRoom here.

function canModifyTask(taskReport, sessionAccountID, policyRole = '') {
if (ReportUtils.isCanceledTaskReport(taskReport)) {
return false;
}
if (sessionAccountID === getTaskOwnerAccountID(taskReport) || sessionAccountID === getTaskAssigneeAccountID(taskReport)) {
return true;
}
const parentReport = ReportUtils.getParentReport(taskReport);
if (policyRole && (ReportUtils.isChatRoom(parentReport) || ReportUtils.isPolicyExpenseChat(parentReport)) && policyRole !== CONST.POLICY.ROLE.ADMIN) {
return false;
}
// If you don't have access to the task report (maybe haven't opened it yet), check if you can access the parent report

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

We need to add this condition in canModifyTask method so that users who is the member in chat room can edit the task.

if (ReportUtils.isChatRoom(parentReport) && parentReport.participantAccountIDs.includes(sessionAccountID)) {
        return true;
    }
screen-capture.4.webm
screen-capture.5.webm

What alternative solutions did you explore?

(Optional)
N/A

@FitseTLT
Copy link
Contributor

Proposal

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

Able to edit task as room's member but not a member of Workspace

What is the root cause of that problem?

Now in canModifyTask we are not denying modifying a task if a user is only a memeber of the room but not member of the workspace.

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

We should disallow the user to modify if the user is not a member of the workspace in Task.canModifyTask
under here

if (policyRole && (ReportUtils.isChatRoom(parentReport) || ReportUtils.isPolicyExpenseChat(parentReport)) && policyRole !== CONST.POLICY.ROLE.ADMIN) {
return false;
}

if (ReportUtils.isPolicyExpenseChat(parentReport) && !policyRole) {
        return false;
    }

What alternative solutions did you explore? (Optional)

@puneetlath
Copy link
Contributor

Coming from this discussion, the behavior we want is that any room member should be able to edit tasks created in the room.

@namhihi237
Copy link
Contributor

updated proposal

@unidev727
Copy link
Contributor

@puneetlath
I added the result video.

@melvin-bot melvin-bot bot added the Overdue label Dec 25, 2023
Copy link

melvin-bot bot commented Dec 25, 2023

@puneetlath, @aimane-chnaif Whoops! This issue is 2 days overdue. Let's get this updated quick!

Copy link

melvin-bot bot commented Dec 27, 2023

@puneetlath, @aimane-chnaif Huh... This is 4 days overdue. Who can take care of this?

Copy link

melvin-bot bot commented Dec 28, 2023

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@puneetlath
Copy link
Contributor

@aimane-chnaif thoughts on the proposals?

@melvin-bot melvin-bot bot removed the Overdue label Dec 28, 2023
@DylanDylann
Copy link
Contributor

@puneetlath Currently, If I create a new room in workspace A and create a new task in that room:

  • If we invite a new user (B) to that room, User B can edit this task
  • If we invite a new user (C) to the workspace A, User C can't edit this task

Please help to confirm the expected. Note that in the previous issue we only allow creator, admin and assignee edit task

cc @aldo-expensify ping you here because we did a related task #31863 before

@melvin-bot melvin-bot bot added the Overdue label Jan 1, 2024
Copy link

melvin-bot bot commented Jan 1, 2024

@puneetlath, @aimane-chnaif Whoops! This issue is 2 days overdue. Let's get this updated quick!

Copy link

melvin-bot bot commented Jan 1, 2024

@puneetlath, @aimane-chnaif Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@puneetlath
Copy link
Contributor

puneetlath commented Jan 2, 2024

The expectation is that any room member can edit the task. Specifically when the task is in a room. cc @quinthar @thienlnam

@melvin-bot melvin-bot bot removed the Overdue label Jan 2, 2024
@unidev727
Copy link
Contributor

unidev727 commented Jan 2, 2024

@puneetlath
Here my solution checks if the user is room member and allows him to edit the task.

if (ReportUtils.isChatRoom(parentReport) && parentReport.participantAccountIDs.includes(sessionAccountID)) {
        return true;
    }

@puneetlath puneetlath added External Added to denote the issue can be worked on by a contributor and removed Internal Requires API changes or must be handled by Expensify staff labels Jan 25, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jan 25, 2024
Copy link

melvin-bot bot commented Jan 25, 2024

Current assignee @aimane-chnaif is eligible for the External assigner, not assigning anyone new.

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Jan 25, 2024
Copy link

melvin-bot bot commented Jan 25, 2024

📣 @aimane-chnaif 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

Copy link

melvin-bot bot commented Jan 25, 2024

📣 @DylanDylann 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Jan 26, 2024
@DylanDylann
Copy link
Contributor

@aimane-chnaif The PR is ready for review #35219

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Feb 7, 2024
@melvin-bot melvin-bot bot changed the title [$500] Task – Able to edit task as room's member but not a member of Workspace [HOLD for payment 2024-02-14] [$500] Task – Able to edit task as room's member but not a member of Workspace Feb 7, 2024
Copy link

melvin-bot bot commented Feb 7, 2024

Reviewing label has been removed, please complete the "BugZero Checklist".

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Feb 7, 2024
Copy link

melvin-bot bot commented Feb 7, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.37-7 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-02-14. 🎊

For reference, here are some details about the assignees on this issue:

Copy link

melvin-bot bot commented Feb 7, 2024

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:

  • [@aimane-chnaif / @DylanDylann] The PR that introduced the bug has been identified. Link to the PR:
  • [@aimane-chnaif / @DylanDylann] 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:
  • [@aimane-chnaif / @DylanDylann] 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:
  • [@aimane-chnaif / @DylanDylann] Determine if we should create a regression test for this bug.
  • [@aimane-chnaif / @DylanDylann] 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.
  • [@puneetlath] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@puneetlath
Copy link
Contributor

@aimane-chnaif friendly reminder about the checklist so that we can pay in a couple of days.

@aimane-chnaif
Copy link
Contributor

  • The PR that introduced the bug has been identified. Link to the PR: Fix/31863: Don't allow member to edit task in room #32165
  • 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: https://github.com/Expensify/App/pull/32165/files#r1486566646
  • 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: N/A
  • Determine if we should create a regression test for this bug.
  • 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.

Regression Test Proposal

  1. Create workspace A
  2. Create a room of above workspace
  3. Create the task in this room
  4. Invite user B, C to this room
  5. Invite user B to workspace A
  6. As user B, navigate to the room conversation where the task was created
  7. Verify that user B can edit task
  8. As user C, navigate to the room conversation where the task was created
  9. Verify that user C can edit task

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Feb 13, 2024
@puneetlath
Copy link
Contributor

Issue for regression test: https://github.com/Expensify/Expensify/issues/369720

@puneetlath
Copy link
Contributor

All paid. Thanks y'all!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor
Projects
No open projects
Status: CRITICAL
Development

No branches or pull requests

9 participants