Skip to content

[Due for payment 2025-08-13] [Due for payment 2025-08-11] [$250] Expense - Admin has no option to remove hold in expense report when there is only one expense #62436

Closed

Description

@vincdargento

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.1.47-2
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from TestRail: #62003
Email or phone of affected tester (no customers): applausetester+sdsdom3jo@applause.expensifail.com
Issue reported by: Applause Internal Team
Device used: Mac 15.4 / Chrome
App Component: Money Requests

Action Performed:

Precondition:

  • Log in with Expensifail account.
  • Admin invites member to the workspace.
  1. Go to staging.new.expensify.com
  2. [Member] Submit an expense to the workspace chat.
  3. [Member] Click on the expense preview.
  4. [Member] Click More > Hold.
  5. [Member] Enter reason and save it.
  6. [Admin] Go to workspace chat with member.
  7. [Admin] Right click on the expense preview.
  8. [Admin] There is an option to remove hold in the context menu.
  9. [Admin] Click on the expense preview.
  10. [Admin] Click More.
  11. [Admin] Click on the report header.

Expected Result:

There should be an option to remove hold in the expense report when there is only one expense.

Actual Result:

There is no option to remove hold in the expense report when there is only one expense.

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

bug.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021925044052011969294
  • Upwork Job ID: 1925044052011969294
  • Last Price Increase: 2025-05-28
  • Automatic offers:
    • dominictb | Reviewer | 107529678
    • nkdengineer | Contributor | 107529680
    • Tony-MK | Contributor | 107974298

Activity

  1. added
    Daily
    Bug
    on May 20, 2025
  2. melvin-bot commented on May 20, 2025

    @melvin-bot

    Triggered auto assignment to @kadiealexander (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. twilight2294 commented on May 20, 2025

    @twilight2294
    Contributor

    Proposal

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

    Admin has no option to remove hold in expense report when there is only one expense

    What is the root cause of that problem?

    The condition to show the unapprove option is wrong:

    return isExpenseReport && isReportApprover && isReportApproved;

    This causes the unhold option to not show up correctly as isReportApproved is false here

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

    We need to use the correct conditions from canHoldUnholdReportAction to display the unhold button:

    App/src/libs/ReportUtils.ts

    Lines 3932 to 3939 in 55a87d8

    function canHoldUnholdReportAction(reportAction: OnyxInputOrEntry<ReportAction>): {canHoldRequest: boolean; canUnholdRequest: boolean} {
    if (!isMoneyRequestAction(reportAction)) {
    return {canHoldRequest: false, canUnholdRequest: false};
    }
    const moneyRequestReportID = getOriginalMessage(reportAction)?.IOUReportID;
    const moneyRequestReport = getReportOrDraftReport(String(moneyRequestReportID));

    We need to use this one to display the button correctly

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    N/A UI issue, but if we want, we can render the options and check for the button to be present

    What alternative solutions did you explore? (Optional)

    N/A

  4. nkdengineer commented on May 21, 2025

    @nkdengineer
    Contributor

    🚨 Edited by proposal-police: This proposal was edited at 2025-05-21 00:03:31 UTC.

    Proposal

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

    There is no option to remove hold in the expense report when there is only one expense.

    What is the root cause of that problem?

    We only show remove hold button for holder in this condition

    // Transaction is attached to expense report but hold action is attached to transaction thread report
    const isHolder = reportTransactions.some((transaction) => isHoldCreator(transaction, transactionThreadReportID));
    return isHolder;

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

    1. We should pass policy for isRemoveHoldAction function
        function isRemoveHoldAction(report: Report, reportTransactions: Transaction[], policy?: Policy)
    
    1. We'll show remove hold button for admin and approver
        const isReportApprover = isApproverUtils(policy, getCurrentUserAccountID());
        const isAdmin = policy?.role === CONST.POLICY.ROLE.ADMIN;
    
        .... 
        return isHolder || isReportApprover || isAdmin;
    

    // Transaction is attached to expense report but hold action is attached to transaction thread report
    const isHolder = reportTransactions.some((transaction) => isHoldCreator(transaction, transactionThreadReportID));
    return isHolder;

    OR update function isRemoveHoldAction like we did here to show remove hold button if canModifyUnholdStatus is true

    App/src/libs/ReportUtils.ts

    Lines 3974 to 3975 in 55a87d8

    const canModifyStatus = !isTrackExpenseMoneyReport && (isAdmin || isActionOwner || isApprover);
    const canModifyUnholdStatus = !isTrackExpenseMoneyReport && (isAdmin || (isActionOwner && isHoldActionCreator) || isApprover);

    const canUnholdRequest = !!(canHoldOrUnholdRequest && isOnHold && (isRequestIOU ? isHoldActionCreator : canModifyUnholdStatus));

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    We should add test for the function isRemoveHoldAction to cover this scenario

    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
    External
    on May 21, 2025
  6. changed the title [-]Expense - Admin has no option to remove hold in expense report when there is only one expense[/-] [+][$250] Expense - Admin has no option to remove hold in expense report when there is only one expense[/+] on May 21, 2025
  7. melvin-bot commented on May 21, 2025

    @melvin-bot
  8. added
    Help Wanted
    on May 21, 2025
  9. moved this to Bugs and Follow Up Issues in #expensify-bugson May 21, 2025
  10. melvin-bot commented on May 21, 2025

    @melvin-bot

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

  11. Tony-MK commented on May 21, 2025

    @Tony-MK
    Contributor

    🚨 Edited by proposal-police: This proposal was edited at 2025-05-21 21:27:42 UTC.

    Proposal

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

    Expense - Admin has no option to remove the hold in the expense report when there is only one expense

    What is the root cause of that problem?

    In ReportSecondaryActionUtils.ts, we didn't create CONST.REPORT.SECONDARY_ACTIONS.REMOVE_HOLD and a function, like isRemoveHoldAction, for getSecondaryReportActions to check if it can push CONST.REPORT.SECONDARY_ACTIONS.REMOVE_HOLD into the option when their is a single expense or multiple expenses.

    We only created isHoldActionForTransaction to check if an expense can be held.

    function getSecondaryTransactionThreadActions(parentReport: Report, reportTransaction: Transaction): Array<ValueOf<typeof CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS>> {
    const options: Array<ValueOf<typeof CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS>> = [];
    if (isHoldActionForTransaction(parentReport, reportTransaction)) {
    options.push(CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS.HOLD);
    }

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

    Create a function similar to isRemoveHoldAction and the CONST.REPORT.SECONDARY_ACTIONS.REMOVE_HOLD in CONSTS.ts.

    Since other functions reuse the same original name in ReportPrimaryActionUtils.ts and ReportSecondaryActionUtils.ts, we can keep the same name, isRemoveHoldAction.

    function isRemoveHoldAction(report: Report, reportTransactions: Transaction[], reportActions?: ReportAction[], policy?: Policy): boolean {
        const isReportOnHold = reportTransactions.some(isOnHoldTransactionUtils);
    
        if (!isReportOnHold) {
            return false;
        }
    
        const transactionThreadReportID = getOneTransactionThreadReportID(report.reportID, reportActions);
    
        if (!transactionThreadReportID) {
            return false;
        }
    
        const isHolder = reportTransactions.some((transaction) => isHoldCreator(transaction, transactionThreadReportID))
    
        if (isHolder){
            return false;
        }
    
        return policy?.role === CONST.POLICY.ROLE.ADMIN || isApproverUtils(policy, getCurrentUserAccountID())
    }

    Use isRemoveHoldAction in getSecondaryReportActions to push CONST.REPORT.SECONDARY_ACTIONS.REMOVE_HOLD among the secondary options just like getReportPrimaryAction.

    function getSecondaryReportActions(parentReport: Report, reportTransaction: Transaction, policy:? Policy): Array<ValueOf<typeof CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS>> {
        const options: Array<ValueOf<typeof CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS>> = [];
    
        if (isRemoveHoldAction(report, reportTransactions, reportActions, policy)) {
            options.push(CONST.REPORT.SECONDARY_ACTIONS.REMOVE_HOLD);
        }
        ...

    Finally, in MoneyReportHeader, add a DropdownOption for CONST.REPORT.SECONDARY_ACTIONS.REMOVE_HOLD in secondaryActionsImplementation.

        ...
    },
    [CONST.REPORT.SECONDARY_ACTIONS.REMOVE_HOLD]: {
        text: translate('iou.unhold'),
        icon: Expensicons.Stopwatch,
        value: CONST.REPORT.SECONDARY_ACTIONS.REMOVE_HOLD,
        onSelected: () => {
            const parentReportAction = getReportAction(moneyRequestReport?.parentReportID, moneyRequestReport?.parentReportActionID);
    
            const moneyRequestAction = transactionThreadReportID ? requestParentReportAction : parentReportAction;
            if (!moneyRequestAction) {
                return;
            }
    
            changeMoneyRequestHoldStatus(moneyRequestAction);
        },
    },
    [CONST.REPORT.SECONDARY_ACTIONS.CHANGE_WORKSPACE]: {
        ...

    Note

    Since CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS.REMOVE_HOLD doesn't exist, we should create it in its Dropdown, and a new function called isRemoveHoldActionForTransaction.

    function isRemoveHoldActionForTransaction(report: Report, reportTransaction: Transaction, policy?: Policy): boolean {
      return isOnHoldTransactionUtils(reportTransaction) &&
          (
               isHoldCreator(reportTransaction, report.reportID) || 
               isReportManagerUtils(report) ||
               policy?.role === CONST.POLICY.ROLE.ADMIN ||
               isApproverUtils(policy, getCurrentUserAccountID())
           )
    }

    Then, getSecondaryTransactionThreadActions will use isRemoveHoldActionForTransaction to check if CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS.REMOVE_HOLD should be push as an option.

    function getSecondaryTransactionThreadActions(parentReport: Report, reportTransaction: Transaction, policy?: Policy): Array<ValueOf<typeof CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS>> {
       const options: Array<ValueOf<typeof CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS>> = [];
    
       if (isHoldActionForTransaction(parentReport, reportTransaction)) {
           options.push(CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS.HOLD);
       }
    
       if (isRemoveHoldActionForTransaction(parentReport, reportTransaction, policy)) {
           options.push(CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS.REMOVE_HOLD);
       }
       ...

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    ReportSecondaryActionUtilsTest.ts already has some test cases except for the unhold option for getSecondaryTransactionThreadActions. So let's add one of the hold option and another for this scenioro for getSecondaryReportActions.

    Furthermore, in case not all hold actions were created by the employee, let's make sure we add another test case for isRemoveHoldAction.

  12. 65 remaining items

  13. removed
    Reviewing
    on Aug 4, 2025
  14. melvin-bot commented on Aug 4, 2025

    @melvin-bot

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

  15. melvin-bot commented on Aug 4, 2025

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.88-3 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-08-11. 🎊

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

  16. melvin-bot commented on Aug 4, 2025

    @melvin-bot

    @dominictb @kadiealexander 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. added
    Weekly
    and removed
    Weekly
    on Aug 6, 2025
  18. changed the title [-][Due for payment 2025-08-11] [$250] Expense - Admin has no option to remove hold in expense report when there is only one expense[/-] [+][Due for payment 2025-08-13] [Due for payment 2025-08-11] [$250] Expense - Admin has no option to remove hold in expense report when there is only one expense[/+] on Aug 6, 2025
  19. melvin-bot commented on Aug 6, 2025

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.89-21 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-08-13. 🎊

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

  20. melvin-bot commented on Aug 6, 2025

    @melvin-bot

    @dominictb @kadiealexander 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]

  21. added
    Daily
    and removed
    Weekly
    on Aug 10, 2025
  22. kadiealexander commented on Aug 11, 2025

    @kadiealexander
    Contributor

    Payment Summary

    @dominictb please complete the checklist!

  23. dominictb commented on Aug 11, 2025

    @dominictb
    Contributor

    BugZero Checklist:

    • [Contributor] Classify the bug:
    Bug classification

    Source of bug:

    • 1a. Result of the original design (eg. a case wasn't considered)
    • 1b. Mistake during implementation
    • 1c. Backend bug
    • 1z. Other:

    Where bug was reported:

    • 2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
    • 2b. Reported on staging (eg. found during regression or PR testing)
    • 2d. Reported on a PR
    • 2z. Other:

    Who reported the bug:

    • 3a. Expensify user
    • 3b. Expensify employee
    • 3c. Contributor
    • 3d. QA
    • 3z. Other:
    • [Contributor] 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: NA, the original design missed this case

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source 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: NA

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

      Link to issue: https://github.com/Expensify/Expensify/issues/535302

    Regression Test Proposal

    Test:

    1. [Admin] Create a workspace.
    2. [Admin] Invite a member to the workspace.
    3. [Member] Submit an expenses.
    4. [Member] Hold the expense.
    5. [Admin] Navigate to that expense report.
    6. [Admin] Click the "More" to view the drop-down menu options.
    7. [Admin] Confirm the "Remove Hold" option is available.

    1. [Member] Submit 2 expenses
    2. [Member] Hold one of the expenses
    3. [Admin] Press the held expense to open transaction thread report
    4. [Admin] Confirm the "Remove Hold" option shows as secondary action; but NOT as a primary action

    Do we agree 👍 or 👎

  24. moved this from Bugs and Follow Up Issues to Done in #expensify-bugson Aug 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentBugDailyExternal

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions