App icon indicating copy to clipboard operation
App copied to clipboard

[Held requests] [$250] RBR doesn't show for submitter for remaining held expense

Open m-natarajan opened this issue 1 year ago • 22 comments

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: 9.0.17-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: @garrettmknight Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1723054648634699

Action Performed:

  1. As the employee - Submit 2 Expenses
  2. As the approver - Hold 1 of those 2 expenses
  3. As the approver - approve only the unheld expense

Expected Result:

Employee should see RBR on the expense in LHN

Actual Result:

Employee doesn't see RBR on the expense in LHN unless they open the expense from the workspace chat.

Workaround:

unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • [ ] Android: Native
  • [ ] Android: mWeb Chrome
  • [ ] iOS: Native
  • [ ] iOS: mWeb Safari
  • [x] MacOS: Chrome / Safari
  • [ ] MacOS: Desktop

Screenshots/Videos

https://github.com/user-attachments/assets/ad1f738a-61ca-4a8a-b814-15d0f5d6bf9e

https://github.com/user-attachments/assets/6df7e5ac-d9d3-47c0-8154-d36957cb078a

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01cce2b99466e28beb
  • Upwork Job ID: 1827431504594139000
  • Last Price Increase: 2024-09-07
Issue OwnerCurrent Issue Owner: @situchan

m-natarajan avatar Aug 07 '24 20:08 m-natarajan

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

melvin-bot[bot] avatar Aug 07 '24 20:08 melvin-bot[bot]

@kevinksullivan Huh... This is 4 days overdue. Who can take care of this?

melvin-bot[bot] avatar Aug 13 '24 18:08 melvin-bot[bot]

@kevinksullivan Still overdue 6 days?! Let's take care of this!

melvin-bot[bot] avatar Aug 15 '24 18:08 melvin-bot[bot]

@kevinksullivan 10 days overdue. Is anyone even seeing these? Hello?

melvin-bot[bot] avatar Aug 19 '24 18:08 melvin-bot[bot]

@kevinksullivan this issue was created 2 weeks ago. Are we close to a solution? Let's make sure we're treating this as a top priority. Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

melvin-bot[bot] avatar Aug 21 '24 18:08 melvin-bot[bot]

@kevinksullivan 12 days overdue now... This issue's end is nigh!

melvin-bot[bot] avatar Aug 21 '24 18:08 melvin-bot[bot]

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

melvin-bot[bot] avatar Aug 24 '24 19:08 melvin-bot[bot]

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

melvin-bot[bot] avatar Aug 24 '24 19:08 melvin-bot[bot]

Edited by proposal-police: This proposal was edited at 2024-10-01 10:32:57 UTC.

Proposal

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

RBR doesn't show for submitter for remaining held expense

What is the root cause of that problem?

The root cause of the issue is that the component is receiving a filtered array of reportIDs instead of the complete set of reportIDs from all chat reports. This results in incomplete data being displayed in the component.

To resolve this, we need to ensure that all reportIDs from the chatReports are passed to the component, rather than just a subset that has been filtered.

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

We need to update the component function to pass all updated arrays with reportIDs so that they can be displayed on the LHN.

In the ReportIDsContextProvider (File: https://github.com/Expensify/App/blob/main/src/hooks/useReportIDs.tsx#L134), ensure that it returns all chat reports. Update the return statement to:

return {
  orderedReportIDs: getOrderedReportIDs(derivedCurrentReportID),
  currentReportID: derivedCurrentReportID ?? '-1',
  policyMemberAccountIDs,
  chatReports
};

Next, in the SidebarLinksData function (File: src/pages/home/sidebar/SidebarLinksData.tsx), pass all report IDs to optionListItems. We will need to make the following changes:

  1. Destructure the required values:

const { orderedReportIDs, currentReportID, policyMemberAccountIDs, chatReports } = useReportIDs();

  1. Update the isNonSystemReport function:
function isNonSystemReport(report: any): report is any {
  return report.chatType !== "system" && !!report.reportID;
}

  1. Generate the AllReportIDs array:
const AllReportIDs = Object.values(chatReports)
  .filter(isNonSystemReport)
  .map(report => report.reportID);

  1. Replace the optionListItems prop: Replace optionListItems={orderedReportIDs} with optionListItems={AllReportIDs} to render the reports in the sidebar.

https://github.com/user-attachments/assets/76a1db49-ff04-4655-9fa5-d03a86067156

raza-ak avatar Aug 26 '24 10:08 raza-ak

CC: @robertjchen for vis!

trjExpensify avatar Aug 28 '24 00:08 trjExpensify

@raza-ak thanks for the proposal. The root cause is not correct. Please be more familiar with our codebase. Thanks

situchan avatar Aug 28 '24 07:08 situchan

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

melvin-bot[bot] avatar Aug 28 '24 18:08 melvin-bot[bot]

Awaiting proposals

situchan avatar Aug 29 '24 09:08 situchan

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

melvin-bot[bot] avatar Aug 31 '24 16:08 melvin-bot[bot]

@kevinksullivan, @situchan Eep! 4 days overdue now. Issues have feelings too...

melvin-bot[bot] avatar Sep 03 '24 18:09 melvin-bot[bot]

Edited by proposal-police: This proposal was edited at 2024-09-04 04:06:11 UTC.

Proposal

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

RBR does not display remaining held expense for the submitter.

What is the root cause of that problem?

We show the RBR related to held request violation when the LHN option is one Transaction Thread Report.

https://github.com/Expensify/App/blob/3e5da7810fdc48ce391db3ed3aa7dab86a59c490/src/libs/SidebarUtils.ts#L316-L329

For workspace chat, oneTransactionThreadReportID will always be empty.

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

Add else condition here:

https://github.com/Expensify/App/blob/3e5da7810fdc48ce391db3ed3aa7dab86a59c490/src/libs/SidebarUtils.ts#L316-L329

Display the RBR if there is a violation related to the iouReportID from the report's action.

    } else if (!isEmptyObject(reportActions) && !isEmptyObject(transactionViolations)) {
        const filteredActions = Object.values(reportActions).filter(action => 
            ReportActionsUtils.isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.REPORT_PREVIEW)
        );
    
        for (const action of filteredActions) {
            const iouReportID = ReportActionsUtils.getIOUReportIDFromReportActionPreview(action);
            if (ReportUtils.hasViolations(iouReportID, transactionViolations)) {
                result.brickRoadIndicator = CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR;
                break;
            }
        }
    }


We can add additional checks (pre-filter) to determine if the RBR should only be visible to the submitter by comparing action.childOwnerAccountID with the current user's account ID.

Branch for this solution

What alternative solutions did you explore? (Optional)

N/A

wildan-m avatar Sep 04 '24 03:09 wildan-m

Proposal Updated

  • Pre-filter reportActions based on report preview type, add transactionViolations empty check

wildan-m avatar Sep 04 '24 04:09 wildan-m

Still waiting for an approved proposal. We have one for you @situchan !

kevinksullivan avatar Sep 04 '24 17:09 kevinksullivan

@kevinksullivan @situchan this issue is now 4 weeks old, please consider:

  • Finding a contributor to fix the bug
  • Closing the issue if BZ has been unable to add the issue to a VIP or Wave project
  • If you have any questions, don't hesitate to start a discussion in #expensify-open-source

Thanks!

melvin-bot[bot] avatar Sep 04 '24 18:09 melvin-bot[bot]

@wildan-m thanks for the proposal. The root cause is not clear to me.

Employee doesn't see RBR on the expense in LHN unless they open the expense from the workspace chat.

Can you please explain why the bug is gone if they open the expense report?

situchan avatar Sep 04 '24 20:09 situchan

@situchan Ah, I see. I thought the issue was related to RBR not appearing in the WS chat, but it's actually a BE issue.

wildan-m avatar Sep 06 '24 02:09 wildan-m

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

melvin-bot[bot] avatar Sep 07 '24 16:09 melvin-bot[bot]

@kevinksullivan, @situchan Huh... This is 4 days overdue. Who can take care of this?

melvin-bot[bot] avatar Sep 10 '24 18:09 melvin-bot[bot]

Not overdue

situchan avatar Sep 10 '24 19:09 situchan

Still waiting on proposals. Looping in another BZ member as I'm going OOO

kevinksullivan avatar Sep 11 '24 21:09 kevinksullivan

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

melvin-bot[bot] avatar Sep 11 '24 21:09 melvin-bot[bot]

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

melvin-bot[bot] avatar Sep 14 '24 16:09 melvin-bot[bot]

Not overdue

situchan avatar Sep 16 '24 02:09 situchan

@kevinksullivan, @VictoriaExpensify, @situchan Whoops! This issue is 2 days overdue. Let's get this updated quick!

melvin-bot[bot] avatar Sep 19 '24 18:09 melvin-bot[bot]

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

melvin-bot[bot] avatar Sep 21 '24 16:09 melvin-bot[bot]