Skip to content

[HOLD for payment 2024-07-17] [$250] Task – Green dot disappears with a delay in LHN when task is completed #44087

Closed

Description

@m-natarajan

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: 1.4.86-0
Reproducible in staging?: y
Reproducible in production?: y
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/4647657
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 as user A

  3. Create a task without assignee in a room, where user B is a member

  4. Log in as user B

  5. Open task and assign it to yourself

  6. Find task in LHN and verify green dot appears

  7. Mark task as complete

Expected Result:

Green dot disappears without delay in LHN when task is completed

Actual Result:

Green dot disappears with a delay in LHN when task is completed

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

Bug6519414_1718889153740.Green_dot.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01fd4e242d6ffc4ea6
  • Upwork Job ID: 1804185858023926931
  • Last Price Increase: 2024-06-21
  • Automatic offers:
    • bernhardoj | Contributor | 102916582
Issue OwnerCurrent Issue Owner: @zanyrenney

Activity

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

    @melvin-bot

    Triggered auto assignment to @zanyrenney (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.

  3. m-natarajan commented on Jun 20, 2024

    @m-natarajan
    Author

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

  4. m-natarajan commented on Jun 20, 2024

    @m-natarajan
    Author

    We think that this bug might be related to #vip-vsb

  5. bernhardoj commented on Jun 21, 2024

    @bernhardoj
    Contributor

    Proposal

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

    The green dot in LHN doesn't immediately disappear when completing a task.

    What is the root cause of that problem?

    There are multiple conditions for the green dot to show, but in our case, we just focus on these 2 conditions.

    App/src/libs/ReportUtils.ts

    Lines 2316 to 2322 in 633e708

    if (isUnreadWithMention(optionOrReport)) {
    return true;
    }
    if (isWaitingForAssigneeToCompleteTask(optionOrReport, parentReportAction)) {
    return true;
    }

    isUnreadWithMention will be true if the lastReadTime is smaller than the lastMentionedTime. A new task report doesn't have a lastReadTime. When we assign a task to ourselves, a new message is shown
    assigned to {mention}
    which adds a mention to ourselves. So, the lastMentionedTime returns from the EditTaskAssignee API.

    Because the lastReadTime is empty and defaults to an empty string, it's smaller than the lastMentionedTime. This makes the LHN title bold too (unread).

    App/src/libs/ReportUtils.ts

    Lines 2288 to 2290 in 633e708

    const lastMentionedTime = reportOrOption.lastMentionedTime ?? '';
    const lastReadTime = reportOrOption.lastReadTime ?? '';
    return !!('isUnreadWithMention' in reportOrOption && reportOrOption.isUnreadWithMention) || lastReadTime < lastMentionedTime;

    When we complete the task, isWaitingForAssigneeToCompleteTask returns false, but isUnreadWithMention still returns true. After a few seconds, the CompleteTask API returns the up-to-date lastReadTime which hides the green dot.
    image

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

    I think we have 2 issues here. The LHN becomes unread when assigning a task to ourselves and the green dot and unread don't immediately disappear after completing a task.

    To fix the second issue, we can optimistically set a lastReadTime when completing the task.

    function completeTask(taskReport: OnyxEntry<OnyxTypes.Report>) {
    const taskReportID = taskReport?.reportID ?? '-1';
    const message = `marked as complete`;
    const completedTaskReportAction = ReportUtils.buildOptimisticTaskReportAction(taskReportID, CONST.REPORT.ACTIONS.TYPE.TASK_COMPLETED, message);
    const optimisticData: OnyxUpdate[] = [
    {
    onyxMethod: Onyx.METHOD.MERGE,
    key: `${ONYXKEYS.COLLECTION.REPORT}${taskReportID}`,
    value: {
    stateNum: CONST.REPORT.STATE_NUM.APPROVED,
    statusNum: CONST.REPORT.STATUS_NUM.APPROVED,
    },
    },

    lastReadTime: DateUtils.getDBTime(),
    

    (and revert it back when it fails)

    For the first issue, I think it requires both FE and BE fix. On FE, we can optimistically update the lastReadTime just like above when editing the assignee (or other fields). However, this isn't enough because the lastMentionedTime from EditTaskAssignee will still be bigger than the optimistic lastReadTime. So, I think the EditTaskAssignee API should return both lastReadTime and lastMentionedTime and have them at least equal.

  6. zanyrenney commented on Jun 21, 2024

    @zanyrenney
    Contributor

    Yes this looks VSB related, lets get this fixed!

  7. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Jun 21, 2024
  8. changed the title [-]Task – Green dot disappears with a delay in LHN when task is completed[/-] [+][$250] Task – Green dot disappears with a delay in LHN when task is completed[/+] on Jun 21, 2024
  9. melvin-bot commented on Jun 21, 2024

    @melvin-bot
  10. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Jun 21, 2024
  11. melvin-bot commented on Jun 21, 2024

    @melvin-bot

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

  12. melvin-bot commented on Jun 24, 2024

    @melvin-bot

    @allroundexperts, @zanyrenney Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  13. 34 remaining items

  14. bernhardoj commented on Jul 17, 2024

    @bernhardoj
    Contributor

    Requested in ND

  15. changed the title [-][HOLD for payment 2024-07-22] [HOLD for payment 2024-07-17] [$250] Task – Green dot disappears with a delay in LHN when task is completed[/-] [+][HOLD for payment 2024-07-17] [$250] Task – Green dot disappears with a delay in LHN when task is completed[/+] on Jul 19, 2024
  16. zanyrenney commented on Jul 19, 2024

    @zanyrenney
    Contributor

    payment summary

    @allroundexperts requires payment through NewDot Manual Requests - please request $250 via ND
    @bernhardoj requires payment automatic offer (Contributor) - please ignore upwork offer as i see you are paid via ND. please request $250 via ND

  17. JmillsExpensify commented on Jul 19, 2024

    @JmillsExpensify
    Contributor

    $250 approved for @bernhardoj

  18. allroundexperts commented on Jul 28, 2024

    @allroundexperts
    Contributor

    Checklist

    1. I was not able to pinpoint any specific PR which caused this. The logic for green dot is dependent on many conditions and it is highly likely that multiple changes lead up to this.
    2. N/A
    3. N/A
    4. A regression test would be helpful here.

    Regression test

    1. Open the app and login as user A
    2. Create a room and add a user B to it
    3. Create a task in the room and do not add any assignee to it
    4. Login as user B
    5. Open the task that was created in step 3 and assign it to yourself
    6. Find task in LHN and verify green dot appears
    7. Mark task as complete

    Verify that the green dot disappears without delay in LHN when task is completed

    Do we 👍 or 👎 ?

  19. JmillsExpensify commented on Aug 21, 2024

    @JmillsExpensify
    Contributor

    $250 approved for @allroundexperts

  20. JmillsExpensify commented on Aug 21, 2024

    @JmillsExpensify
    Contributor

    Opening this back up for the regression test.

  21. zanyrenney commented on Aug 22, 2024

    @zanyrenney
    Contributor

    My b, thanks @JmillsExpensify

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.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions