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

[$500] Expense - Green dot disappears from LHN when paying one out of many unpaid reports #34767

Open
6 tasks done
lanitochka17 opened this issue Jan 18, 2024 · 69 comments
Open
6 tasks done
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Engineering Internal Requires API changes or must be handled by Expensify staff Weekly KSv2

Comments

@lanitochka17
Copy link

lanitochka17 commented Jan 18, 2024

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.27-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
Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal Team
Slack conversation:

Action Performed:

Precondition: There is a Collect workspace on Old Dot with admin and employee
pre-steps to have multiple reports for testing -

  • Go to the workspace settings > More features > Enable Workflows
  • Go to the Workflows tab in the LHN
  • Enable Delay submissions
  • Keep the default workflow of Submit and Close
  1. [Employee] Create a manual request in the workspace chat and submit it
  2. [Employee] Create another manual request and submit it
  3. {Admin] Go to workspace chat with employee
  4. [Admin] Pay the second submitted report (submitted in Step 2)
  5. Note that the LHN does not show green dot
  6. [Admin] Click on the preview of first submitted report (Step 1) and return to the main chat

Expected Result:

In Step 4, green dot should still appear for the workspace chat in LHN because there is still unpaid report

Actual Result:

In Step 4, LHN for the workspace chat with unpaid report does not show green dot after paying one of the reports. It only shows green dot when revisiting main chat from the expense report

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

Bug6346954_1705607247509.20240119_001119.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01fffa54d6d963be62
  • Upwork Job ID: 1748072099859210240
  • Last Price Increase: 2024-01-18
Issue OwnerCurrent Issue Owner: @roryabraham
@lanitochka17 lanitochka17 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 Jan 18, 2024
@melvin-bot melvin-bot bot changed the title Expense - Green dot disappears from LHN when paying one out of many unpaid reports [$500] Expense - Green dot disappears from LHN when paying one out of many unpaid reports Jan 18, 2024
Copy link

melvin-bot bot commented Jan 18, 2024

Job added to Upwork: https://www.upwork.com/jobs/~01fffa54d6d963be62

Copy link

melvin-bot bot commented Jan 18, 2024

Triggered auto assignment to @peterdbarkerUK (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 Jan 18, 2024
Copy link

melvin-bot bot commented Jan 18, 2024

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

@lanitochka17
Copy link
Author

@tienifr
Copy link
Contributor

tienifr commented Jan 19, 2024

Proposal

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

In Step 4, LHN for the workspace chat with unpaid report does not show green dot after paying one of the reports. It only shows green dot when revisiting main chat from the expense report.

What is the root cause of that problem?

We're setting the hasOutstandingChildRequest to false immediately here when paying money request, without checking whether there're still more outstanding child requests that are unpaid.

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

Check that there're no other outstanding child requests first before setting hasOutstandingChildRequest to false in optimistic data above.

There're a couple of ways to do this:
1.

  • Fix the back-end to return hasOutstandingChildRequest: true properly for the unpaid IOU report (currently it's returning hasOutstandingChildRequest: false even though those IOU reports are unpaid)
  • Then in here, check the list of IOU report that corresponds to the report preview report actions in the chat report, and only set hasOutstandingChildRequest to false if no other IOU reports have hasOutstandingChildRequest: true
  1. Or we can use conditions similar to this to check if the REPORTPREVIEW needs to be paid (instead of using the hasOutstandingChildRequest on the IOU report)

What alternative solutions did you explore? (Optional)

We can add a back-end field outstandingChildRequestCount that is the total count of outstanding child requests (similar idea to the childVisibleActionCount of the reportAction). When we pay the request, in optimistic data we reduce the outstandingChildRequestCount by 1, and only set hasOutstandingChildRequest to false if after paying this request, the outstandingChildRequestCount becomes 0.

@allroundexperts
Copy link
Contributor

I think Option 2 from @tienifr's proposal should work fine and be inline with the code that we are already using.

🎀 👀 🎀 C+ reviewed

Copy link

melvin-bot bot commented Jan 21, 2024

Triggered auto assignment to @roryabraham, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@peterdbarkerUK
Copy link
Contributor

@mountiny
Copy link
Contributor

@roryabraham I believe to implement this properly, we would need to create App version of this Auth method and make sure we use this in backend when the report is reimbursed to update the GBR correctly.

@roryabraham
Copy link
Contributor

I believe to implement this properly, we would need to create App version of this Auth method and make sure we use this in backend when the report is reimbursed to update the GBR correctly.

we do have ReportUtils::requiresAttentionFromCurrentUser which seems about the same – I wish these didn't have to be re-implemented and we could just have some shared logic in a C++ function that we could use in both places, but that's probably out-of-scope for this issue...

Fix the back-end to return hasOutstandingChildRequest: true properly for the unpaid IOU report (currently it's returning hasOutstandingChildRequest: false even though those IOU reports are unpaid)

This sounds like it needs to be fixed, regardless. I think I prefer @tienifr's solution #1. I'm happy to assign him, but he'll be blocked on the back-end change.

Now I'm starting to think more seriously about creating some shared C++ libs for non-trivial business logic like this that's very input/output oriented and needs to be kept in sync across layers. But as that would be a new pattern, we need to discuss it further.

Sorry I don't have a more decisive conclusion here just yet – it's very late for me so I want to look at this one more time with fresher eyes.

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

melvin-bot bot commented Jan 29, 2024

@peterdbarkerUK, @allroundexperts, @roryabraham Eep! 4 days overdue now. Issues have feelings too...

@allroundexperts
Copy link
Contributor

Hi @roryabraham!
Just following up on above. Did you get a chance to look at this again with a fresh pair of eyes?

@melvin-bot melvin-bot bot removed the Overdue label Jan 29, 2024
Copy link

melvin-bot bot commented Feb 1, 2024

@peterdbarkerUK @allroundexperts @roryabraham this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

@melvin-bot melvin-bot bot added the Overdue label Feb 1, 2024
@melvin-bot melvin-bot bot removed the Overdue label Feb 1, 2024
@kadiealexander kadiealexander added Overdue Bug Something is broken. Auto assigns a BugZero manager. and removed Bug Something is broken. Auto assigns a BugZero manager. labels Feb 1, 2024
Copy link

melvin-bot bot commented Feb 1, 2024

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

@trjExpensify trjExpensify added Weekly KSv2 and removed Monthly KSv2 labels Aug 15, 2024
@roryabraham
Copy link
Contributor

It's not clear how to reproduce this now, since the two submitted manual requests are batched together and it's not clear how to pay the 2nd one without paying the 1st:

image

@roryabraham
Copy link
Contributor

Same deal with P2P requests:

image

so this is indeed no longer reproducible

@roryabraham
Copy link
Contributor

@tienifr feel free to provide updated reproduction steps if you'd like

@trjExpensify
Copy link
Contributor

I suspect you had the workspace set to instant submit @roryabraham, so this needs a coupla' pre-steps to have multiple reports:

  • Go to the workspace settings > More features > Enable Workflows
  • Go to the Workflows tab in the LHN
  • Enable Delay submissions

@trjExpensify trjExpensify reopened this Aug 23, 2024
@slafortune
Copy link
Contributor

Yes - I can still recreate this when setting delay submission. I've updated the test steps to include that and leaving submit and close.

@melvin-bot melvin-bot bot added the Overdue label Sep 2, 2024
@roryabraham
Copy link
Contributor

chatted with @trjExpensify in slack, it's unlikely I'll be able to prioritize this one this week so we may look for another volunteer

@melvin-bot melvin-bot bot removed the Overdue label Sep 3, 2024
@slafortune
Copy link
Contributor

Looking for a volunteer here - https://expensify.slack.com/archives/C049HHMV9SM/p1725553790788449

@melvin-bot melvin-bot bot added the Overdue label Sep 11, 2024
@roryabraham
Copy link
Contributor

PayMoneyRequest sample response
{
    "onyxData": [
        {
            "key": "report_2881610082725380",
            "onyxMethod": "merge",
            "value": {
                "participants": {
                    "4": {
                        "hidden": true,
                        "notificationPreference": "hidden"
                    }
                }
            }
        },
        {
            "key": "report_2881610082725380",
            "onyxMethod": "merge",
            "value": {
                "chatType": "",
                "description": "",
                "lastActorAccountID": 4,
                "lastMessageText": "marked this report as reimbursed",
                "lastVisibleActionCreated": "2024-09-16 22:15:39.923",
                "managerID": 4,
                "ownerAccountID": 4,
                "parentReportActionID": "7465655876950814176",
                "parentReportID": "616431942157016",
                "policyID": "5F78EE68DC8314F9",
                "reportID": "2881610082725380",
                "reportName": "Expense Report #2881610082725380",
                "state": "MANUALREIMBURSED",
                "stateNum": 2,
                "statusNum": 2,
                "type": "expense",
                "visibility": null
            }
        },
        {
            "key": "reportActions_2881610082725380",
            "onyxMethod": "merge",
            "value": {
                "1708872886801724526": {
                    "actionName": "MARKEDREIMBURSED",
                    "actorAccountID": 4,
                    "avatar": "https:\/\/d2g02b6ed2w9fz.cloudfront.net\/7d759bc82ab83bbf508cb84009e17d654532c700_128.jpeg",
                    "created": "2024-09-16 22:15:39.923",
                    "lastModified": "2024-09-16 22:15:39.923",
                    "message": [
                        {
                            "html": "",
                            "text": "",
                            "type": "COMMENT",
                            "whisperedTo": []
                        }
                    ],
                    "originalMessage": {
                        "lastModified": "2024-09-16 22:15:39.923",
                        "type": "Elsewhere"
                    },
                    "person": [
                        {
                            "style": "strong",
                            "text": "RoryTest Admin",
                            "type": "TEXT"
                        }
                    ],
                    "reportActionID": "1708872886801724526",
                    "shouldShow": true
                }
            }
        },
        {
            "key": "personalDetailsList",
            "onyxMethod": "merge",
            "value": {
                "4": {
                    "accountID": 4,
                    "avatar": "https:\/\/d2g02b6ed2w9fz.cloudfront.net\/7d759bc82ab83bbf508cb84009e17d654532c700_128.jpeg",
                    "displayName": "RoryTest Admin",
                    "firstName": "RoryTest",
                    "lastName": "Admin",
                    "login": "roryabrahamtest+admin@gmail.com",
                    "phoneNumber": "",
                    "pronouns": "",
                    "status": null,
                    "timezone": {
                        "automatic": false,
                        "selected": "America\/Los_Angeles"
                    },
                    "validated": true
                }
            }
        },
        {
            "key": "report_2881610082725380",
            "onyxMethod": "merge",
            "value": {
                "statusNum": 4
            }
        },
        {
            "key": "report_2881610082725380",
            "onyxMethod": "merge",
            "value": {
                "stateNum": 2
            }
        },
        {
            "key": "report_2881610082725380",
            "onyxMethod": "merge",
            "value": {
                "participants": {
                    "4": {
                        "hidden": true,
                        "notificationPreference": "hidden"
                    }
                }
            }
        },
        {
            "key": "report_2881610082725380",
            "onyxMethod": "merge",
            "value": {
                "chatType": "",
                "description": "",
                "lastActorAccountID": 4,
                "lastMessageText": "paid $20.00 elsewhere",
                "lastVisibleActionCreated": "2024-09-16 22:15:39.925",
                "managerID": 4,
                "ownerAccountID": 4,
                "parentReportActionID": "7465655876950814176",
                "parentReportID": "616431942157016",
                "policyID": "5F78EE68DC8314F9",
                "reportID": "2881610082725380",
                "reportName": "Expense Report #2881610082725380",
                "state": "MANUALREIMBURSED",
                "stateNum": 2,
                "statusNum": 4,
                "type": "expense",
                "visibility": null
            }
        },
        {
            "key": "reportActions_2881610082725380",
            "onyxMethod": "merge",
            "shouldShowPushNotification": true,
            "value": {
                "433572443584605772": {
                    "actionName": "IOU",
                    "actorAccountID": 4,
                    "avatar": "https:\/\/d2g02b6ed2w9fz.cloudfront.net\/7d759bc82ab83bbf508cb84009e17d654532c700_128.jpeg",
                    "created": "2024-09-16 22:15:39.925",
                    "lastModified": "2024-09-16 22:15:39.925",
                    "message": [
                        {
                            "html": "paid $20.00 elsewhere",
                            "text": "paid $20.00 elsewhere",
                            "type": "COMMENT",
                            "whisperedTo": []
                        }
                    ],
                    "originalMessage": {
                        "IOUReportID": 2881610082725380,
                        "amount": 2000,
                        "currency": "USD",
                        "entryID": null,
                        "lastModified": "2024-09-16 22:15:39.925",
                        "paymentType": "Elsewhere",
                        "type": "pay"
                    },
                    "person": [
                        {
                            "style": "strong",
                            "text": "RoryTest Admin",
                            "type": "TEXT"
                        }
                    ],
                    "reportActionID": "433572443584605772",
                    "shouldShow": true
                }
            }
        },
        {
            "key": "personalDetailsList",
            "onyxMethod": "merge",
            "value": {
                "4": {
                    "accountID": 4,
                    "avatar": "https:\/\/d2g02b6ed2w9fz.cloudfront.net\/7d759bc82ab83bbf508cb84009e17d654532c700_128.jpeg",
                    "displayName": "RoryTest Admin",
                    "firstName": "RoryTest",
                    "lastName": "Admin",
                    "login": "roryabrahamtest+admin@gmail.com",
                    "phoneNumber": "",
                    "pronouns": "",
                    "status": null,
                    "timezone": {
                        "automatic": false,
                        "selected": "America\/Los_Angeles"
                    },
                    "validated": true
                }
            }
        },
        {
            "key": "reportActions_616431942157016",
            "onyxMethod": "merge",
            "value": {
                "7465655876950814176": {
                    "actionName": "REPORTPREVIEW",
                    "actorAccountID": 4,
                    "avatar": "https:\/\/d2g02b6ed2w9fz.cloudfront.net\/7d759bc82ab83bbf508cb84009e17d654532c700_128.jpeg",
                    "childCommenterCount": 0,
                    "childLastActorAccountID": 4,
                    "childLastMoneyRequestComment": "",
                    "childLastReceiptTransactionIDs": "",
                    "childLastVisibleActionCreated": "",
                    "childMoneyRequestCount": 1,
                    "childOldestFourAccountIDs": "",
                    "childRecentReceiptTransactionIDs": [],
                    "childReportNotificationPreference": "hidden",
                    "childType": "expense",
                    "childVisibleActionCount": 0,
                    "created": "2024-09-16 22:15:17.788",
                    "lastModified": "2024-09-16 22:15:17.788",
                    "message": [
                        {
                            "html": "paid $20.00 elsewhere",
                            "text": "paid $20.00 elsewhere",
                            "type": "COMMENT",
                            "whisperedTo": []
                        }
                    ],
                    "originalMessage": {
                        "lastModified": "2024-09-16 22:15:17.788",
                        "linkedReportID": "2881610082725380"
                    },
                    "person": [
                        {
                            "style": "strong",
                            "text": "RoryTest Admin",
                            "type": "TEXT"
                        }
                    ],
                    "reportActionID": "7465655876950814176",
                    "shouldShow": true
                }
            }
        },
        {
            "key": "report_2881610082725380",
            "onyxMethod": "merge",
            "value": {
                "isCancelledIOU": false
            }
        },
        {
            "key": "report_2881610082725380",
            "onyxMethod": "merge",
            "value": {
                "lastReadTime": "2024-09-16 22:15:39.925"
            }
        },
        {
            "key": "report_616431942157016",
            "onyxMethod": "merge",
            "value": {
                "hasOutstandingChildRequest": false,
                "iouReportID": null
            }
        },
        {
            "key": "report_616431942157016",
            "onyxMethod": "merge",
            "value": {
                "lastActorAccountID": 4,
                "lastMessageText": "paid $20.00 elsewhere",
                "lastVisibleActionCreated": "2024-09-16 22:15:17.788",
                "maxSequenceNumber": null,
                "reportID": "616431942157016"
            }
        },
        {
            "key": "reportActions_616431942157016",
            "onyxMethod": "merge",
            "shouldNotify": false,
            "value": {
                "7465655876950814176": {
                    "actionName": "REPORTPREVIEW",
                    "actorAccountID": 4,
                    "automatic": false,
                    "avatar": "https:\/\/d2g02b6ed2w9fz.cloudfront.net\/7d759bc82ab83bbf508cb84009e17d654532c700_128.jpeg",
                    "childLastActorAccountID": 4,
                    "childManagerAccountID": 4,
                    "childMoneyRequestCount": 1,
                    "childOwnerAccountID": 4,
                    "childReportID": "2881610082725380",
                    "childReportName": "Expense Report #2881610082725380",
                    "childReportNotificationPreference": "hidden",
                    "childStateNum": 2,
                    "childStatusNum": 4,
                    "childType": "expense",
                    "created": "2024-09-16 22:15:17.788",
                    "isAttachment": false,
                    "lastModified": "2024-09-16 22:15:17.788",
                    "message": [
                        {
                            "deleted": "",
                            "html": "paid $20.00 elsewhere",
                            "isDeletedParentAction": false,
                            "isEdited": false,
                            "reactions": [],
                            "text": "paid $20.00 elsewhere",
                            "type": "COMMENT",
                            "whisperedTo": []
                        }
                    ],
                    "originalMessage": {
                        "lastModified": "2024-09-16 22:15:17.788",
                        "linkedReportID": "2881610082725380"
                    },
                    "person": [
                        {
                            "style": "strong",
                            "text": "RoryTest Admin",
                            "type": "TEXT"
                        }
                    ],
                    "reportActionID": "7465655876950814176",
                    "reportActionTimestamp": 1726524917788,
                    "sequenceNumber": null,
                    "shouldShow": true,
                    "timestamp": 1726524917,
                    "whisperedToAccountIDs": []
                }
            }
        },
        {
            "key": "report_2881610082725380",
            "onyxMethod": "merge",
            "value": {
                "avatarUrl": null,
                "chatReportID": "616431942157016",
                "chatType": "",
                "currency": "USD",
                "description": "",
                "errorFields": {
                    "export": null,
                    "notFound": null
                },
                "fieldList": null,
                "hasOutstandingChildRequest": false,
                "hasOutstandingChildTask": false,
                "hasParentAccess": true,
                "invoiceReceiver": null,
                "iouReportID": null,
                "isCancelledIOU": false,
                "isDeletedParentAction": null,
                "isOwnPolicyExpenseChat": false,
                "isPinned": false,
                "isWaitingOnBankAccount": false,
                "lastActionType": "IOU",
                "lastActorAccountID": "4",
                "lastMessageHtml": "paid $20.00 elsewhere",
                "lastMessageText": "paid $20.00 elsewhere",
                "lastReadSequenceNumber": 0,
                "lastVisibleActionCreated": "2024-09-16 22:15:39.925",
                "lastVisibleActionLastModified": "2024-09-16 22:15:39.925",
                "managerID": 4,
                "nonReimbursableTotal": 0,
                "notificationPreference": "hidden",
                "oldPolicyName": "",
                "ownerAccountID": 4,
                "parentReportActionID": "7465655876950814176",
                "parentReportID": "616431942157016",
                "participants": {
                    "4": {
                        "hidden": true,
                        "notificationPreference": "hidden"
                    }
                },
                "permissions": [],
                "policyAvatar": null,
                "policyID": "5F78EE68DC8314F9",
                "policyName": null,
                "private_isArchived": "",
                "reportID": "2881610082725380",
                "reportName": "Expense Report #2881610082725380",
                "stateNum": 2,
                "statusNum": 4,
                "total": -2000,
                "tripData": null,
                "type": "expense",
                "unheldTotal": -2000,
                "visibility": null,
                "welcomeMessage": "",
                "writeCapability": "all"
            }
        },
        {
            "key": "report_2881610082725380",
            "onyxMethod": "merge",
            "value": {
                "lastActorAccountID": 4,
                "lastMentionedTime": null,
                "lastMessageText": "You",
                "lastReadTime": "2024-09-16 22:15:39.925",
                "lastVisibleActionCreated": "2024-09-16 22:15:39.923",
                "maxSequenceNumber": 3,
                "reportID": "2881610082725380"
            }
        },
        {
            "key": "reportActions_2881610082725380",
            "onyxMethod": "merge",
            "shouldNotify": false,
            "value": {
                "1708872886801724526": {
                    "actionName": "MARKEDREIMBURSED",
                    "actorAccountID": 4,
                    "automatic": false,
                    "avatar": "https:\/\/d2g02b6ed2w9fz.cloudfront.net\/7d759bc82ab83bbf508cb84009e17d654532c700_128.jpeg",
                    "created": "2024-09-16 22:15:39.923",
                    "isAttachment": false,
                    "lastModified": "2024-09-16 22:15:39.923",
                    "message": [
                        {
                            "style": "strong",
                            "text": "You",
                            "type": "TEXT"
                        },
                        {
                            "style": "normal",
                            "text": " marked this report as manually reimbursed. This report will be reimbursed outside of Expensify",
                            "type": "TEXT"
                        }
                    ],
                    "originalMessage": {
                        "lastModified": "2024-09-16 22:15:39.923",
                        "type": "Elsewhere"
                    },
                    "person": [
                        {
                            "style": "strong",
                            "text": "RoryTest Admin",
                            "type": "TEXT"
                        }
                    ],
                    "reportActionID": "1708872886801724526",
                    "reportActionTimestamp": 1726524939923,
                    "sequenceNumber": 3,
                    "shouldShow": false,
                    "timestamp": 1726524939,
                    "whisperedToAccountIDs": []
                }
            }
        },
        {
            "key": "report_2881610082725380",
            "onyxMethod": "merge",
            "value": {
                "lastActorAccountID": 4,
                "lastMentionedTime": null,
                "lastMessageText": "paid $20.00 elsewhere",
                "lastReadTime": "2024-09-16 22:15:39.925",
                "lastVisibleActionCreated": "2024-09-16 22:15:39.925",
                "maxSequenceNumber": 4,
                "reportID": "2881610082725380"
            }
        },
        {
            "key": "reportActions_2881610082725380",
            "onyxMethod": "merge",
            "shouldNotify": false,
            "value": {
                "433572443584605772": {
                    "actionName": "IOU",
                    "actorAccountID": 4,
                    "automatic": false,
                    "avatar": "https:\/\/d2g02b6ed2w9fz.cloudfront.net\/7d759bc82ab83bbf508cb84009e17d654532c700_128.jpeg",
                    "created": "2024-09-16 22:15:39.925",
                    "isAttachment": false,
                    "lastModified": "2024-09-16 22:15:39.925",
                    "message": [
                        {
                            "deleted": "",
                            "html": "paid $20.00 elsewhere",
                            "isDeletedParentAction": false,
                            "isEdited": false,
                            "reactions": [],
                            "text": "paid $20.00 elsewhere",
                            "type": "COMMENT",
                            "whisperedTo": []
                        }
                    ],
                    "originalMessage": {
                        "IOUReportID": 2881610082725380,
                        "amount": 2000,
                        "currency": "USD",
                        "entryID": null,
                        "lastModified": "2024-09-16 22:15:39.925",
                        "paymentType": "Elsewhere",
                        "type": "pay"
                    },
                    "person": [
                        {
                            "style": "strong",
                            "text": "RoryTest Admin",
                            "type": "TEXT"
                        }
                    ],
                    "reportActionID": "433572443584605772",
                    "reportActionTimestamp": 1726524939925,
                    "sequenceNumber": 4,
                    "shouldShow": true,
                    "timestamp": 1726524939,
                    "whisperedToAccountIDs": []
                }
            }
        },
        {
            "key": "report_2881610082725380",
            "onyxMethod": "merge",
            "value": {
                "avatarUrl": null,
                "chatReportID": "616431942157016",
                "chatType": "",
                "currency": "USD",
                "description": "",
                "errorFields": {
                    "export": null,
                    "notFound": null
                },
                "fieldList": null,
                "hasOutstandingChildRequest": false,
                "hasOutstandingChildTask": false,
                "hasParentAccess": true,
                "invoiceReceiver": null,
                "iouReportID": null,
                "isCancelledIOU": false,
                "isDeletedParentAction": null,
                "isOwnPolicyExpenseChat": false,
                "isPinned": false,
                "isWaitingOnBankAccount": false,
                "lastActionType": "IOU",
                "lastActorAccountID": "4",
                "lastMentionedTime": null,
                "lastMessageHtml": "paid $20.00 elsewhere",
                "lastMessageText": "paid $20.00 elsewhere",
                "lastReadSequenceNumber": 0,
                "lastReadTime": "2024-09-16 22:15:39.925",
                "lastVisibleActionCreated": "2024-09-16 22:15:39.925",
                "lastVisibleActionLastModified": "2024-09-16 22:15:39.925",
                "managerID": 4,
                "nonReimbursableTotal": 0,
                "notificationPreference": "hidden",
                "oldPolicyName": "",
                "ownerAccountID": 4,
                "parentReportActionID": "7465655876950814176",
                "parentReportID": "616431942157016",
                "participants": {
                    "4": {
                        "hidden": true,
                        "notificationPreference": "hidden"
                    }
                },
                "permissions": [],
                "policyAvatar": null,
                "policyID": "5F78EE68DC8314F9",
                "policyName": null,
                "private_isArchived": "",
                "reportID": "2881610082725380",
                "reportName": "Expense Report #2881610082725380",
                "stateNum": 2,
                "statusNum": 4,
                "total": -2000,
                "tripData": null,
                "type": "expense",
                "unheldTotal": -2000,
                "visibility": null,
                "welcomeMessage": "",
                "writeCapability": "all"
            }
        },
        {
            "key": "report_616431942157016",
            "onyxMethod": "merge",
            "value": {
                "iouReportID": null
            }
        },
        {
            "key": "reportNextStep_2881610082725380",
            "onyxMethod": "set",
            "value": {
                "icon": "checkmark",
                "message": [
                    {
                        "text": "No further action required!"
                    }
                ],
                "nextReceiver": "",
                "requiresUserAction": false,
                "showForExpense": true,
                "showForMobile": true,
                "showUndoSubmit": false,
                "title": "Finished!",
                "type": "neutral"
            }
        }
    ],
    "jsonCode": 200,
    "requestID": "jgJeg1",
    "previousUpdateID": 10252,
    "lastUpdateID": 10268
}

@melvin-bot melvin-bot bot removed the Overdue label Sep 16, 2024
@roryabraham
Copy link
Contributor

relevant front-end code:

const shouldShowGreenDotIndicator = !hasBrickError && ReportUtils.requiresAttentionFromCurrentUser(optionItem, optionItem.parentReportAction);

@roryabraham
Copy link
Contributor

Ok, so I think that the hasOutstandingChildRequest Onyx update in PayMoneyRequest comes from here, which in turn comes from the giant getChats function. In there, I think I might need to unpack ReportItem::isAwaitingActionFromCurrentUser a bit more

@roryabraham
Copy link
Contributor

Update: I think the linked IOU is not being found here when it should be. Testing in focus mode right now, but also will need to test in most recent mode too.

Also, maybe this can be DRYed up but this is performance-sensitive code so I might default to trying to just get this working rather than rocking the boat too much.

@melvin-bot melvin-bot bot added the Overdue label Sep 25, 2024
@roryabraham
Copy link
Contributor

@thienlnam volunteered to grab this one from me since tomorrow's my last day before parental leave and I'm focusing on trying to complete (or almost complete) CP to Prod

@melvin-bot melvin-bot bot removed the Overdue label Oct 3, 2024
@roryabraham roryabraham assigned thienlnam and unassigned roryabraham Oct 3, 2024
@trjExpensify
Copy link
Contributor

Nice one, thank you Jack!

@melvin-bot melvin-bot bot added the Overdue label Oct 14, 2024
@thienlnam
Copy link
Contributor

Been sidetracked wrapping up things for Hubspot doc, but will look into this in the next couple o days

@melvin-bot melvin-bot bot removed the Overdue label Oct 16, 2024
@trjExpensify trjExpensify changed the title [Collect approvers] [$500] Expense - Green dot disappears from LHN when paying one out of many unpaid reports [$500] Expense - Green dot disappears from LHN when paying one out of many unpaid reports Oct 16, 2024
@thienlnam
Copy link
Contributor

Summarizing some things in the thread for my own investigation

Auth flow

  1. PayMoneyRequest is called here, which in turn calls getChats and then proceeds to structure the report for onyx.
  2. The way hasOutstandingChildRequest is calculated is via ReportItem::isAwaitingActionFromCurrentUser
  3. So I need to investigate whether the linkedReport is showing up as part of getLinkedReports (here), or why isAwaitingActionFromCurrentUser is not triggering

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Engineering Internal Requires API changes or must be handled by Expensify staff Weekly KSv2
Projects
Status: CRITICAL
Status: Release 2.5: SuiteWorld (Sept 9th)
Development

No branches or pull requests