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 2023-07-21] [$1000] Message “Complete task…” should not be displayed when the user is marked as done task not assigned #20542

Closed
1 of 6 tasks
kavimuru opened this issue Jun 9, 2023 · 74 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 Waiting for copy User facing verbiage needs polishing

Comments

@kavimuru
Copy link

kavimuru commented Jun 9, 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!


Action Performed:

  1. Login 2 accounts on 2 devices A and B
  2. A Create chat with B
  3. A Create a task 1 but not assign anyone
  4. B click into task 1
  5. B click Mark as Done

Expected Result:

The message complete task shouldn’t show

Actual Result::

The message complete task show

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

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.26-1
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

Screen.Recording.2023-06-08.at.16.20.23.mov
Recording.931.mp4

Expensify/Expensify Issue URL:
Issue reported by: @namhihi237
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1685993057669719

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~019928155ae5bbd4b8
  • Upwork Job ID: 1668264032406409216
  • Last Price Increase: 2023-06-27
@kavimuru kavimuru added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jun 9, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 9, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jun 9, 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

@BhuvaneshPatil
Copy link
Contributor

BhuvaneshPatil commented Jun 9, 2023

Proposal

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

The task that has no assignee can be marked as done by other user

What is the root cause of that problem?

There are three places from where a task can be marked as completed

  • A check box in TaskPreview

    <Checkbox
    style={[styles.mr2]}
    containerStyle={[styles.taskCheckbox]}
    isChecked={isTaskCompleted}
    disabled={TaskUtils.isTaskCanceled(props.taskReport)}
    onPress={() => {
    if (isTaskCompleted) {
    TaskUtils.reopenTask(props.taskReportID, taskTitle);
    } else {
    TaskUtils.completeTask(props.taskReportID, taskTitle);
    }
    }}
    />

  • Mark As Done button in TaskHeader

    <Button
    success
    isDisabled={TaskUtils.isTaskCanceled(props.report)}
    medium
    text={props.translate('newTaskPage.markAsDone')}
    onPress={() => TaskUtils.completeTask(props.report.reportID, title)}
    />

  • Mark as Done option in HeaderView

    threeDotMenuItems.push({
    icon: Expensicons.Checkmark,
    text: props.translate('newTaskPage.markAsDone'),
    onSelected: () => Task.completeTask(props.report.reportID, title),
    });

At all these places we are not adding any check if the button can be clicked by particular user or not.
These buttons are visible to everyone.

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

We can add the check to confirm if the user has right access to perform certain action.
And that action can be performed or not.
With my understanding, I think the task creator and assignee can perform the action of Mark as Done or Mark As Incomplete.
For checkbox and button we can add the disable prop according to those user level permissions and add a tooltip to describe that they are not allowed to perform this action.
For menuItem we can add another condition in if statement.

As mentioned in this comment #20542 (comment)
We will need to have errors handled, this is new part to proposal -
We need to update thefailureData in Task, there are three situations that need to be handled -
When user performs -

  • Mark as done
  • Cancel
  • Mark as Incomplete (reopen)

We need to decide on the message that we need to show to user. To handle the failure data we'll add the error message as -

  1. Mark as done action -
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${taskReportID}`,
value: {[completedTaskReportAction.reportActionID]: {pendingAction: null,    
errors: ErrorUtils.getMicroSecondOnyxError("You don't have permission to complete, re-open or cancel this task")}},
  1. Cancel action -
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${taskReportID}`,
value: {[optimisticCancelReportAction.reportActionID]: {
            errors: ErrorUtils.getMicroSecondOnyxError("You don't have permission to complete, re-open or cancel this task")}
,
  1. Reopen action -
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${taskReportID}`,
value: {[reopenedTaskReportAction.reportActionID]: {
errors: ErrorUtils.getMicroSecondOnyxError("You don't have permission to complete, re-open or cancel this task")}
},

What alternative solutions did you explore? (Optional)

None

@puneetlath puneetlath removed their assignment Jun 9, 2023
@puneetlath puneetlath added Bug Something is broken. Auto assigns a BugZero manager. and removed Bug Something is broken. Auto assigns a BugZero manager. labels Jun 9, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 9, 2023

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

@melvin-bot

This comment was marked as duplicate.

@puneetlath
Copy link
Contributor

@NicMendonca re-assigning over to you since i'm going OOO for the next week. Thanks!

@namhihi237
Copy link
Contributor

Proposal

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

The message “completed task” and “Re open task” does not appear in task detail when ticking the checkbox or press “Mark as done”, “Mark as incomplete” on task not assinged

What is the root cause of that problem?

Now, Only the task creator and assignee can complete and repoen the task. After calling completeTask and reopenTask, reportAction is saved to Onyx with optimisticData, But after API return permission error, failureData has not deleted reportAction saved above.

{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${taskReportID}`,
value: {[completedTaskReportAction.reportActionID]: {pendingAction: null}},
},

{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${taskReportID}`,
value: {[reopenedTaskReportAction.reportActionID]: {pendingAction: null}},
},

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

To solve this problem we will set reportAction = null if the API returns an error.
In completedTask:

{
        onyxMethod: Onyx.METHOD.MERGE,
	key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${taskReportID}`,
	value: {[completedTaskReportAction.reportActionID]: null},
},

In reopenTask:

{
	onyxMethod: Onyx.METHOD.MERGE,
	key:`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${taskReportID}`,
	value: {[reopenedTaskReportAction.reportActionID]: null},
},

Result:

Screen.Recording.2023-06-10.at.05.08.13.mov

What alternative solutions did you explore? (Optional)

Disable button, checkbox where these 2 APIs are called by checking if current user is owner or assigned

@dukenv0307
Copy link
Contributor

Proposal

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

The message "Complete task..." should not be displayed when the user is marked as done task that the user is not owner or assignee

What is the root cause of that problem?

When the user completes the task, optimisticData is saved in Onyx with reportAction complete task. But after API returns data with error, failureData doesn't update the error for this reportAction to explain why the user cannot complete the task and can remove this report action.

value: {[completedTaskReportAction.reportActionID]: {pendingAction: null}},

This issue also happens when the user re-opens the task
value: {[reopenedTaskReportAction.reportActionID]: {pendingAction: null}},

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

When the user completes or re-opens the task, after API return error failureData should update the error for report action instead of updating pending action is null like this. And we also need to create a new translation for this error.

onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${taskReportID}`,
value: {[completedTaskReportAction.reportActionID]: {
    errors: ErrorUtils.getMicroSecondOnyxError("You don't have permission to complete or re-open this task")
}},
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${taskReportID}`,
value: {[reopenedTaskReportAction.reportActionID]: {
    errors: ErrorUtils.getMicroSecondOnyxError("You don't have permission to complete or re-open this task")
}},

What alternative solutions did you explore? (Optional)

We can disable checkbox, mask as done button and re-open task button for the user that is not owner or assignee. But I think all users can click on them and we will display the error with the user doesn't have permission is good because that help the users learn more about the usage of task and also understand why they cannot complete or re-open the task.

Result for main solution

Screencast.from.12-06-2023.10.09.49.webm

@NicMendonca NicMendonca added the External Added to denote the issue can be worked on by a contributor label Jun 12, 2023
@melvin-bot melvin-bot bot changed the title Message “Complete task…” should not be displayed when the user is marked as done task not assigned [$1000] Message “Complete task…” should not be displayed when the user is marked as done task not assigned Jun 12, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 12, 2023

Job added to Upwork: https://www.upwork.com/jobs/~019928155ae5bbd4b8

@melvin-bot
Copy link

melvin-bot bot commented Jun 12, 2023

Current assignee @NicMendonca is eligible for the External assigner, not assigning anyone new.

@melvin-bot
Copy link

melvin-bot bot commented Jun 12, 2023

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

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

melvin-bot bot commented Jun 12, 2023

Triggered auto assignment to @alex-mechler (External), see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@mollfpr
Copy link
Contributor

mollfpr commented Jun 12, 2023

Thanks for the proposals!

We will hide the Mark as done button in this issue #19631 (comment)

So I'd like a solution for handling the failure action in this issue.

@alex-mechler I'm curious if we will have another error from the API other than the permission error on completing task?

@melvin-bot melvin-bot bot removed the Overdue label Jun 12, 2023
@dukenv0307
Copy link
Contributor

So I'd like a solution for handling the failure action in this issue.

@mollfpr Can you take a look at my proposal #20542 (comment). it handles the failureData for action to display the error.

@mollfpr
Copy link
Contributor

mollfpr commented Jun 12, 2023

@dukenv0307 Is the error from API is only about permission?

@melvin-bot melvin-bot bot added the Awaiting Payment Auto-added when associated PR is deployed to production label Jul 14, 2023
@melvin-bot melvin-bot bot changed the title [$1000] Message “Complete task…” should not be displayed when the user is marked as done task not assigned [HOLD for payment 2023-07-21] [$1000] Message “Complete task…” should not be displayed when the user is marked as done task not assigned Jul 14, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jul 14, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 14, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jul 14, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.40-5 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 2023-07-21. 🎊

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@melvin-bot
Copy link

melvin-bot bot commented Jul 14, 2023

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:

  • [@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:
  • [@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:
  • [@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.
  • [@NicMendonca] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jul 20, 2023
@mollfpr
Copy link
Contributor

mollfpr commented Jul 21, 2023

[@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. This is an improvement on the task feature.

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

[@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. Login with user A
  2. On another device, log in with user B
  3. From user B, create a task with share somewhere is user A and the assignee is a user that isn't user A
  4. From user A, click on the checkbox of the task message
  5. Click on the arrow right icon to go to the task report
  6. Verify that an error message appears below the message and the error message is You do not have the permission to do the requested action.
  7. Switch language to Spanish
  8. Verify that the error message is No tiene permiso para realizar la acción solicitada.
  9. 👍 or 👎

@melvin-bot melvin-bot bot added the Overdue label Jul 24, 2023
@NicMendonca
Copy link
Contributor

@namhihi237 can you accept the offer please?

@melvin-bot melvin-bot bot removed the Overdue label Jul 24, 2023
@NicMendonca
Copy link
Contributor

@dukenv0307 you've been paid

@NicMendonca
Copy link
Contributor

@mollfpr just to confirm you'll be requesting payment via Expensify?

@mollfpr
Copy link
Contributor

mollfpr commented Jul 24, 2023

@NicMendonca Nope, still using same old Upwork.

@namhihi237
Copy link
Contributor

I just accepted @NicMendonca

@NicMendonca
Copy link
Contributor

everyone has been paid ✅ BZ checklist done ✅

Thanks!

@dukenv0307
Copy link
Contributor

@NicMendonca I think this issue is eligible for a bonus timeline. Because

  1. We just wait to confirm the copy text from 3/7 --> 6/7 (I raised a comment to confirm copy text from 3/7 [HOLD for payment 2023-07-21] [$1000] Message “Complete task…” should not be displayed when the user is marked as done task not assigned #20542 (comment))
  2. The internal engineer OOO for two days as mentioned here Display error when cannot complete task #22097 (review)
    cc @mollfpr

@NicMendonca
Copy link
Contributor

@dukenv0307 I am not reading this as within 3 business days:

  • You were assigned on June 30th
  • PR Opened July 2nd
  • C+ Approved changed ready for internal Eng on July 9th

@dukenv0307
Copy link
Contributor

@NicMendonca

  1. July 1st and July 2nd are on the weekend and then This PR is on hold from the comment to the comment
  2. We request the internal engineer for the first time on July 6th
Screenshot 2023-07-28 at 09 31 27

@NicMendonca
Copy link
Contributor

We request the internal engineer for the first time on July 6th

I'm sorry - I am still not reading this as the PR being merged within 3 business days.

If you were assigned on the 30th on June and requested internal eng on July 6th, then that is 5 business days

@NicMendonca
Copy link
Contributor

discussing internally here

@dukenv0307
Copy link
Contributor

@NicMendonca It seems you miss this point
July 1st and July 2nd are on the weekend and then This PR is on hold from 3/6 to 6/6 (GMT +7) (The PR should be held on this time so this period is not included in the bonus timeline)

@NicMendonca
Copy link
Contributor

@dukenv0307 I am not counting the weekend.

I am counting as followed:

  • Friday June 30th - you were assigned - this is the start of the timer
  • Monday July 3rd - day 2
  • Tuesday July 4th - day 3
  • Wednesday July 5th - day 5

^ This is 4 business days.

@NicMendonca NicMendonca reopened this Aug 1, 2023
@dukenv0307
Copy link
Contributor

dukenv0307 commented Aug 1, 2023

@NicMendonca

My timezone (GMT + 7)

I was assigned on July 1

Screenshot 2023-08-01 at 23 12 05

After the weekend, I created the PR on July 3

And I added this comment #20542 (comment) to wait for internal team to add waiting for copy label to assign a member that can help us confirm the translation key. So from 3/6 to 6/6 the PR was held for this and I think it shouldn't be calculated to work day.

After the confirmation C+ approve the PR on July 6

Screenshot 2023-08-01 at 23 14 38

Before the CME of this issue back from OOO, we just need to merge main to resolve the conflict.

Correct me If I missed something.

@NicMendonca
Copy link
Contributor

@dukenv0307 you're not missing something, but there is a lot of grey areas here.

So to that end, @mollfpr @dukenv0307 speed bonus has been paid via Upwork.

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 Waiting for copy User facing verbiage needs polishing
Projects
None yet
Development

No branches or pull requests