Skip to content

[Due for payment 2025-11-18] [$250] Reports - Dropdown menu shows "Approve" when one of the selected expenses is already approved #73879

Closed

Description

@jponikarchuk

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: 9.2.41-2
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: Exploratory
Email or phone of affected tester (no customers): sdniosjsdonsj@gmail.com
Issue reported by: Applause Internal Team
Device used: Mac 15.5 / Chrome
App Component: Money Requests

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to workspace chat.
  3. Create two expenses.
  4. Click Submit and Approve.
  5. Create another expense.
  6. Click Submit.
  7. Go to Reports > Reports.
  8. Expand both report rows.
  9. Select one of the expenses from approved report (from Step 4) and select the unapproved expense (from Step 6).
  10. Click dropdown button.

Expected Result:

Dropdown menu will not show Approve button because one of the selected expenses is already approved.

Actual Result:

Dropdown menu still shows Approve button when one of the selected expenses is already approved.

This issue does not happen if user selects all expenses from both reports.

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

1.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021984369165659568760
  • Upwork Job ID: 1984369165659568760
  • Last Price Increase: 2025-10-31
  • Automatic offers:
    • nkdengineer | Contributor | 109347077
Issue OwnerCurrent Issue Owner: @Christinadobrzyn

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Oct 30, 2025
  2. melvin-bot commented on Oct 30, 2025

    @melvin-bot

    Triggered auto assignment to @Christinadobrzyn (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. daledah commented on Oct 30, 2025

    @daledah
    Contributor

    Proposal

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

    Dropdown menu still shows Approve button when one of the selected expenses is already approved.

    What is the root cause of that problem?

    Because we selected one report that hasn’t been approved yet and one transaction from an approved report, we’re failing this condition.

    const shouldShowApproveOption =
    !isOffline &&
    !isAnyTransactionOnHold &&
    (selectedReports.length
    ? selectedReports.every((report) => report.allActions.includes(CONST.SEARCH.ACTION_TYPES.APPROVE))
    : selectedTransactionsKeys.every((id) => selectedTransactions[id].action === CONST.SEARCH.ACTION_TYPES.APPROVE));

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

    We should update this condition to use selectedTransactionsKeys like we did with other actions

          const shouldShowApproveOption =
              !isOffline &&
              !isAnyTransactionOnHold && selectedTransactionsKeys.length > 0 && selectedTransactionsKeys.every((id) => selectedTransactions[id].action === CONST.SEARCH.ACTION_TYPES.APPROVE);
    

    const shouldShowApproveOption =
    !isOffline &&
    !isAnyTransactionOnHold &&
    (selectedReports.length
    ? selectedReports.every((report) => report.allActions.includes(CONST.SEARCH.ACTION_TYPES.APPROVE))
    : selectedTransactionsKeys.every((id) => selectedTransactions[id].action === CONST.SEARCH.ACTION_TYPES.APPROVE));

    We should update other places that use selectedReports condition as well

        const selectedPolicyIDList = Object.values(selectedTransactions).map((transaction) => transaction.policyID);
    

    // Check if any of the selected items have DEW enabled
    const selectedPolicyIDList = selectedReports.length
    ? selectedReports.map((report) => report.policyID)
    : Object.values(selectedTransactions).map((transaction) => transaction.policyID);

        const transactionIDList = Object.keys(selectedTransactions);
        const reportIDList = Object.values(selectedTransactions).map((transaction) => transaction.reportID);
    

    const transactionIDList = selectedReports.length ? undefined : Object.keys(selectedTransactions);
    const reportIDList = !selectedReports.length
    ? Object.values(selectedTransactions).map((transaction) => transaction.reportID)
    : (selectedReports?.filter((report) => !!report).map((report) => report.reportID) ?? []);

    Note: we can do the same with other actions that has the same problems

    What alternative solutions did you explore? (Optional)

    Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

  4. nkdengineer commented on Oct 31, 2025

    @nkdengineer
    Contributor

    Proposal

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

    Dropdown menu still shows Approve button when one of the selected expenses is already approved.

    What is the root cause of that problem?

    The selectedReports is only added if we select all transactions of a report. In our case, we select a submitted report and one transaction from the approved report, so selectedReports only include the submitted report and. then the approve button is shown.

    const shouldShowApproveOption =
    !isOffline &&
    !isAnyTransactionOnHold &&
    (selectedReports.length
    ? selectedReports.every((report) => report.allActions.includes(CONST.SEARCH.ACTION_TYPES.APPROVE))
    : selectedTransactionsKeys.every((id) => selectedTransactions[id].action === CONST.SEARCH.ACTION_TYPES.APPROVE));
    if (shouldShowApproveOption) {
    options.push({
    icon: Expensicons.ThumbsUp,
    text: translate('search.bulkActions.approve'),
    value: CONST.SEARCH.BULK_ACTION_TYPES.APPROVE,
    shouldCloseModalOnSelect: true,
    onSelected: () => {

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

    Only using selectedTransactionsKeys is incorrect, because when it's grouped by reports, the action is View. Instead, we should check if all selected transactions are included in selectedReports or not. This check ensures that the bulk action like approve doesn't show if we do not select the whole report because we can't approve the transaction individually. We can do the same for other bulk actions that can only be done for the whole report.

    const areSelectedTransactionsIncludedInReports = selectedTransactionsKeys.every((id) => selectedReportIDs.includes(selectedTransactions[id].reportID));
            // Otherwise, we provide the full set of options depending on the state of the selected transactions and reports
            const shouldShowApproveOption =
                !isOffline &&
                !isAnyTransactionOnHold &&
                areSelectedTransactionsIncludedInReports &&
                (selectedReports.length
                    ? selectedReports.every((report) => report.allActions.includes(CONST.SEARCH.ACTION_TYPES.APPROVE))
                    : selectedTransactionsKeys.every((id) => selectedTransactions[id].action === CONST.SEARCH.ACTION_TYPES.APPROVE));
    

    const shouldShowApproveOption =
    !isOffline &&
    !isAnyTransactionOnHold &&
    (selectedReports.length
    ? selectedReports.every((report) => report.allActions.includes(CONST.SEARCH.ACTION_TYPES.APPROVE))
    : selectedTransactionsKeys.every((id) => selectedTransactions[id].action === CONST.SEARCH.ACTION_TYPES.APPROVE));
    if (shouldShowApproveOption) {
    options.push({
    icon: Expensicons.ThumbsUp,
    text: translate('search.bulkActions.approve'),
    value: CONST.SEARCH.BULK_ACTION_TYPES.APPROVE,
    shouldCloseModalOnSelect: true,
    onSelected: () => {

    What alternative solutions did you explore? (Optional)

    Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

  5. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Oct 31, 2025
  6. changed the title [-]Reports - Dropdown menu shows "Approve" when one of the selected expenses is already approved[/-] [+][$250] Reports - Dropdown menu shows "Approve" when one of the selected expenses is already approved[/+] on Oct 31, 2025
  7. melvin-bot commented on Oct 31, 2025

    @melvin-bot
  8. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Oct 31, 2025
  9. melvin-bot commented on Oct 31, 2025

    @melvin-bot

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

  10. jayeshmangwani commented on Nov 3, 2025

    @jayeshmangwani
    Contributor

    @nkdengineer could you please give an example where selectedTransactionsKeys fails? I tried selecting a single transaction from a report, but the Approve button doesn’t show up.

  11. nkdengineer commented on Nov 3, 2025

    @nkdengineer
    Contributor

    @jayeshmangwani Here is the case where this check fails. The Approve button doesn't show because the action of selected transaction is View.

    Screen.Recording.2025-11-03.at.13.31.45.mov
  12. 13 remaining items

  13. changed the title [-][$250] Reports - Dropdown menu shows "Approve" when one of the selected expenses is already approved[/-] [+][Due for payment 2025-11-18] [$250] Reports - Dropdown menu shows "Approve" when one of the selected expenses is already approved[/+] on Nov 11, 2025
  14. melvin-bot commented on Nov 11, 2025

    @melvin-bot

    Reviewing label has been removed, please complete the "BugZero Checklist".

  15. melvin-bot commented on Nov 11, 2025

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.2.48-1 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 2025-11-18. 🎊

    For reference, here are some details about the assignees on this issue:

    • @jayeshmangwani requires $250 payment through NewDot Manual Requests
    • @nkdengineer requires $250 payment through NewDot Manual Requests (Contributor)
  16. melvin-bot commented on Nov 11, 2025

    @melvin-bot

    @jayeshmangwani @Christinadobrzyn The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

  17. Christinadobrzyn commented on Nov 18, 2025

    @Christinadobrzyn
    Contributor

    @jayeshmangwani do we need a regression test?

    Payment summary - #73879 (comment)

  18. mountiny commented on Nov 19, 2025

    @mountiny
    Contributor

    I dont think we need a new one for this case

  19. Christinadobrzyn commented on Nov 19, 2025

    @Christinadobrzyn
    Contributor

    Ok sounds good - payment summary is here - #73879 (comment)

    Both payments are through ND so closing this.

  20. trjExpensify commented on Dec 3, 2025

    @trjExpensify
    Contributor

    approved $250 for @jayeshmangwani

  21. twisterdotcom commented on Mar 11, 2026

    @twisterdotcom
    Contributor

    @nkdengineer has submitted payment for this report on ND here.

    SO: https://stackoverflowteams.com/c/expensify/questions/7582

    Zapier Logs Run ID: 00040eee-ebcb-a18d-970e-26ce29281974
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

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions