Skip to content

[HOLD for payment 2023-07-26] [$1000] Green dot doesn't appear automatically when assigning task to self repeatedly #22149

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. Create a task with no assignee
  2. Open the task report.
  3. Set the assignee to a random person
  4. Set yourself as the assignee
  5. Repeat steps 3 and 4 a couple of times.

Expected Result:

The green dot in LHN should be visible automatically when assigned to self.

Actual Result:

The green dot in LHN is only visible when clicked on another report in LHN.

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.36-2
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

2023-07-03.10.42.39.mp4
Recording.1141.mp4

Expensify/Expensify Issue URL:
Issue reported by: @esh-g
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1688377006505109

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01d5e85cd8d7e7f90a
  • Upwork Job ID: 1677284522382716928
  • Last Price Increase: 2023-07-07

Activity

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

    @melvin-bot

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

  3. melvin-bot commented on Jul 4, 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. dukenv0307 commented on Jul 5, 2023

    @dukenv0307
    Contributor

    Proposal

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

    Green dot doesn't appear automatically when assigning task to self repeatedly

    What is the root cause of that problem?

    SideLink doesn’t update after assign task to self because managerEmail is lack from chatReportSelector

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

    In src/pages/home/sidebar/SidebarLinks.js, We should add managerEmail in chatReportSelector function

    managerEmail: report.managerEmail,

    What alternative solutions did you explore? (Optional)

  5. esh-g commented on Jul 5, 2023

    @esh-g
    Contributor

    Proposal

    Please re-state the problem

    Green dot doesn't appear automatically when assigning task to self repeatedly.

    What is the root cause of that problem?

    The root cause is that the OptionRowLHN (the component which displays the green dot) doesn't get updated when we assign task to self. Now the question arises that when we un-assign ourselves, the component does update but doesn't when we assign it to ourselves.

    The answer lies here in the function Task.setAssigneeValue:

    if (!isCurrentUser) {
    let newChat = {};
    const chat = ReportUtils.getChatByParticipants([newAssigneeAccountID]);
    if (!chat) {
    newChat = ReportUtils.buildOptimisticChatReport([newAssigneeAccountID]);
    }
    const reportID = chat ? chat.reportID : newChat.reportID;
    if (!shareDestination) {
    setShareDestinationValue(reportID);
    }
    Report.openReport(reportID, [assignee], newChat);
    }

    Here you can see that we are explicitly checking if the assigned user is current user and this is what causes this disparity of updation while un-assigning but no updation when assigning. The line that does the updating is Report.openReport on line 498 and as you can see it isn't called when we are setting the assignee to current user.

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

    The use of Report.openReport I think it to make sure the LHN is updated with the latest assignee chat having their assignment message in the subtitle, but obviously we can't use that for the current user as the current user has no report.

    Notice that after calling setAssigneeValue, we are also calling another function called editTaskAndNavigate

    if (props.route.params.reportID && props.task.report.reportID === props.route.params.reportID) {
    // There was an issue where sometimes a new assignee didn't have a DM thread
    // This would cause the app to crash, so we need to make sure we have a DM thread
    TaskUtils.setAssigneeValue(option.login, option.accountID, props.task.shareDestination, OptionsListUtils.isCurrentUser(option));
    // Pass through the selected assignee
    TaskUtils.editTaskAndNavigate(props.task.report, props.session.email, props.session.accountID, {assignee: option.login, assigneeAccountID: option.accountID});
    }

    And in editTaskAndNavigate, we can see that we are dismissing the task modal in the end.

    Navigation.dismissModal(report.reportID);

    Since we are already dismissing the modal, we can also make sure that the report updates by adding the following line after this:

    Report.openReport(report.reportID);

    What other alternative approach did you explore (Optional)

    N/A

  6. NicMendonca commented on Jul 5, 2023

    @NicMendonca
    Contributor

    Trying to reproduce this now

  7. NicMendonca commented on Jul 5, 2023

    @NicMendonca
    Contributor

    @esh-g okay I was able to reproduce, but I was also able to reproduce on MacOS desktop. Can we please confirm all the platforms in which this is happening to ensure parity across all? cc @kavimuru

  8. StevenKKC commented on Jul 6, 2023

    @StevenKKC
    Contributor

    Proposal

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

    Green dot doesn't appear automatically when assigning task to self repeatedly.

    What is the root cause of that problem?

    The root cause is that LHN does not re-render when assigning task to self.

    If assigning task to self, BE responds only one task report that has managerEmail.
    Annotation 2023-07-06 123854

    And if assigning task to others, BE will respond two reports.
    One is a task report, and another is a assignee's chat report that has a lastMessageText.
    Annotation 2023-07-06 123841

    SidebarLinks retrieve reports with using chatReportSelector, and in this function there is no managerEmail.

    chatReports: {
    key: ONYXKEYS.COLLECTION.REPORT,
    selector: chatReportSelector,
    },

    const chatReportSelector = (report) =>
    report && {
    reportID: report.reportID,
    participants: report.participants,
    hasDraft: report.hasDraft,
    isPinned: report.isPinned,
    errorFields: {
    addWorkspaceRoom: report.errorFields && report.errorFields.addWorkspaceRoom,
    },
    lastReadTime: report.lastReadTime,
    lastMentionedTime: report.lastMentionedTime,
    lastMessageText: report.lastMessageText,
    lastVisibleActionCreated: report.lastVisibleActionCreated,
    iouReportID: report.iouReportID,
    hasOutstandingIOU: report.hasOutstandingIOU,
    statusNum: report.statusNum,
    stateNum: report.stateNum,
    chatType: report.chatType,
    policyID: report.policyID,
    reportName: report.reportName,
    };

    So when assigning task to self, side bar will not be re-render, so does not appear green dot automatically.
    And when assigning task to others, since there is a another chat report which has a lastMessageText, side bar will be re-render, and green dot will be disappear.

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

    We can add managerEmail property to chatReportSelector as below.

    const chatReportSelector = (report) =>
        report && {
            ...
    +       managerEmail: report.managerEmail,
        };

    What alternative solutions did you explore? (Optional)

    None.

  9. NicMendonca commented on Jul 7, 2023

    @NicMendonca
    Contributor

    @esh-g also, I think we don't have to specify "repeatedly". It happens when you assign to self after not self-assigning after the first go around when creating the task - but can you please confirm that on your end?

  10. esh-g commented on Jul 7, 2023

    @esh-g
    Contributor

    @NicMendonca Yes, it almost always happens when assigning yourself but there was one time that it did update, so I thought of adding repeatedly but I don't think its required... It was mostly just to assure the reproduction of this bug

  11. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Jul 7, 2023
  12. changed the title [-]Green dot doesn't appear automatically when assigning task to self repeatedly[/-] [+][$1000] Green dot doesn't appear automatically when assigning task to self repeatedly[/+] on Jul 7, 2023
  13. melvin-bot commented on Jul 7, 2023

    @melvin-bot
  14. 29 remaining items

  15. changed the title [-][$1000] Green dot doesn't appear automatically when assigning task to self repeatedly[/-] [+][HOLD for payment 2023-07-26] [$1000] Green dot doesn't appear automatically when assigning task to self repeatedly[/+] on Jul 19, 2023
  16. melvin-bot commented on Jul 19, 2023

    @melvin-bot

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

    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
  17. melvin-bot commented on Jul 19, 2023

    @melvin-bot

    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:
  18. mollfpr commented on Jul 25, 2023

    @mollfpr
    Contributor

    [@mollfpr] The PR that introduced the bug has been identified. Link to the PR:

    #20808

    [@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:

    https://github.com/Expensify/App/pull/20808/files#r1272970129

    [@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. Create a task with no assignee
    2. Open the task report
    3. Set the assignee to a random person
    4. Set yourself as the assignee
    5. Verify that a green dot appears
    6. Set assignee to someone else
    7. Verify that a green dot disappears
    8. 👍 or 👎
  19. mollfpr commented on Jul 25, 2023

    @mollfpr
    Contributor

    @dukenv0307 is eligible for the bonus speed. The assignment is on Jul 13, and my approval of the PR is on Jul 14.

  20. NicMendonca commented on Jul 26, 2023

    @NicMendonca
    Contributor
    • @esh-g - reporting $250
    • @dukenv0307 - C $1500
    • @mollfpr C+ $1500 - paid via Upwork not Expensify, correct? Or has this changed?
  21. NicMendonca commented on Jul 26, 2023

    @NicMendonca
    Contributor
  22. NicMendonca commented on Jul 26, 2023

    @NicMendonca
    Contributor

    @dukenv0307 you've been paid 🎉

  23. mollfpr commented on Jul 26, 2023

    @mollfpr
    Contributor

    @NicMendonca Yeah, the payment still in Upwork.

  24. NicMendonca commented on Jul 26, 2023

    @NicMendonca
    Contributor

    @mollfpr you've been paid!

  25. esh-g commented on Jul 26, 2023

    @esh-g
    Contributor

    @NicMendonca Applied!

  26. NicMendonca commented on Jul 27, 2023

    @NicMendonca
    Contributor

    @esh-g paid!

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