Skip to content

[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

Description

@kavimuru

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

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jun 9, 2023
  2. melvin-bot commented on Jun 9, 2023

    @melvin-bot

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

  3. melvin-bot commented on Jun 9, 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
  4. BhuvaneshPatil commented on Jun 9, 2023

    @BhuvaneshPatil
    Contributor

    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

  5. removed their assignment
    on Jun 9, 2023
  6. added
    BugSomething is broken. Auto assigns a BugZero manager.
    and removed
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jun 9, 2023
  7. melvin-bot commented on Jun 9, 2023

    @melvin-bot

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

  8. melvin-bot commented on Jun 9, 2023

    @melvin-bot
  9. puneetlath commented on Jun 9, 2023

    @puneetlath
    Contributor

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

  10. namhihi237 commented on Jun 9, 2023

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

  11. 107 remaining items

  12. mollfpr commented on Jul 24, 2023

    @mollfpr
    Contributor

    @NicMendonca Nope, still using same old Upwork.

  13. namhihi237 commented on Jul 24, 2023

    @namhihi237
    Contributor

    I just accepted @NicMendonca

  14. NicMendonca commented on Jul 24, 2023

    @NicMendonca
    Contributor

    everyone has been paid ✅ BZ checklist done ✅

    Thanks!

  15. dukenv0307 commented on Jul 27, 2023

    @dukenv0307
    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
  16. NicMendonca commented on Jul 27, 2023

    @NicMendonca
    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
  17. dukenv0307 commented on Jul 28, 2023

    @dukenv0307
    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
  18. NicMendonca commented on Jul 30, 2023

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

  19. NicMendonca commented on Jul 30, 2023

    @NicMendonca
    Contributor

    discussing internally here

  20. dukenv0307 commented on Jul 31, 2023

    @dukenv0307
    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)

  21. NicMendonca commented on Aug 1, 2023

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

  22. dukenv0307 commented on Aug 1, 2023

    @dukenv0307
    Contributor

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

  23. NicMendonca commented on Aug 1, 2023

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

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 contributorWaiting for copyUser facing verbiage needs polishing

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions