Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
3.5k stars 2.85k forks source link

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

Open lanitochka17 opened 9 months ago

lanitochka17 commented 9 months ago

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 -

  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?

Screenshots/Videos

Add any screenshot/video evidence

https://github.com/Expensify/App/assets/78819774/9fa5d1b7-103b-457a-8c67-b280b0ddeba8

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
slafortune commented 2 months ago

Ah! This is outdated, request money is now submit expense. Sorry I missed that, as it stands I can't recreate this and with submit expense I can recreate this.

trjExpensify commented 2 months ago

Sorry, I don't understand this:

Sorry I missed that, as it stands I can't recreate this and with submit expense I can recreate this.

tienifr commented 2 months ago

@trjExpensify @slafortune This is still reproducible in latest main

trjExpensify commented 2 months ago

Cool, thanks. Seems like we still have to look into this then, @roryabraham. On the basis of this, I'm moving it back to weekly as we focus on polish for #wave-collect.

roryabraham commented 2 months ago

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 commented 2 months ago

Same deal with P2P requests:

image

so this is indeed no longer reproducible

roryabraham commented 2 months ago

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

trjExpensify commented 2 months ago

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

slafortune commented 2 months ago

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

roryabraham commented 1 month ago

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

slafortune commented 1 month ago

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

roryabraham commented 1 month ago
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 } ```
roryabraham commented 1 month ago

relevant front-end code: https://github.com/Expensify/App/blob/1db6abb66106b1a855321f907408357fbcc8f78c/src/components/LHNOptionsList/OptionRowLHN.tsx#L118

roryabraham commented 1 month ago

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 commented 1 month ago

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.

roryabraham commented 3 weeks ago

@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

trjExpensify commented 3 weeks ago

Nice one, thank you Jack!

thienlnam commented 1 week ago

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

thienlnam commented 3 days ago

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