Skip to content

[$250] Hold - Red dot remains when approver unhold expense hold by employee #52480

Closed

Description

@lanitochka17

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.0.61-0
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: N/A
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/5207795&group_by=cases:section_id&group_order=asc&group_id=309128
Email or phone of affected tester (no customers): gocemate+workspaceemployee235@gmail.com
Issue reported by: Applause - Internal Team

Action Performed:

Preconditions:

  1. Login as the owner of the workspace
  2. Create a workspace
  3. Invite the approver and employee
  4. Navigate to more features
  5. Enable "workflows"
  6. On the "Workflow" editor - enable "Add Approvals"
  7. Set the Approver account as the Approver
    Steps:
  8. As Employee submit 2 expenses to Workspace chat
  9. As Employee hold the first expense
  10. Verify there is a red dot on the expense that is on Hold on both sides ( employee and approver)
  11. As Approver unhold the first expense
  12. Take a look at the first expense as Employee

Expected Result:

Red dot should disappears in real time since the expense is unheld

Actual Result:

Red dot remains on employee side when approver unhold expense that is hold by employee

Workaround:

Unknown

Platforms:

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

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence
Bug6663641_1731496245368.Recording__4503.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021856774853921792737
  • Upwork Job ID: 1856774853921792737
  • Last Price Increase: 2024-11-20

Activity

  1. added
    Daily
    Bug
    on Nov 13, 2024
  2. melvin-bot commented on Nov 13, 2024

    @melvin-bot

    Triggered auto assignment to @greg-schroeder (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. added
    External
    on Nov 13, 2024
  4. melvin-bot commented on Nov 13, 2024

    @melvin-bot
  5. changed the title [-]Hold - Red dot remains when approver unhold expense hold by employee[/-] [+][$250] Hold - Red dot remains when approver unhold expense hold by employee[/+] on Nov 13, 2024
  6. moved this to Bugs and Follow Up Issues in #expensify-bugson Nov 13, 2024
  7. added
    Help Wanted
    on Nov 13, 2024
  8. melvin-bot commented on Nov 13, 2024

    @melvin-bot

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

  9. NJ-2020 commented on Nov 13, 2024

    @NJ-2020
    Contributor

    Proposal

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

    Hold - Red dot remains when approver unhold expense hold by employee

    What is the root cause of that problem?

    It's because when the approve unhold the expense, the transaction violations data for hold expense still remains, so when we check here if the transaction has violations it will return true

    const shouldShowRBR = hasErrors;

    const hasErrors =
    (hasMissingSmartscanFields && !iouSettled) ||
    // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
    ReportUtils.hasViolations(iouReportID, transactionViolations, true) ||

    But if we try to check the transaction is hold or not by using ReportUtils.hasHeldExpenses it will return false because we check the value of transaction.comment.hold is true or not using !!, since the approver unhold the expense, the transaction.comment.hold become empty string which leads this function to return false
    } else if (ReportUtils.hasHeldExpenses(iouReport?.reportID)) {

    return transactions.some((transaction) => TransactionUtils.isOnHold(transaction));

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

    Inside the hasViolation function, we can check if the violation name is hold then we can use the isOnHold utils to check if the transaction.comment.hold is true or not by using !!

    return transactions.some((transaction) => TransactionUtils.isOnHold(transaction));

    function hasViolation(transactionID: string, transactionViolations: OnyxCollection<TransactionViolations>, showInReview?: boolean): boolean {
        return !!transactionViolations?.[ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS + transactionID]?.some((violation: TransactionViolation) => {
            if (violation.name === CONST.VIOLATIONS.HOLD) {
                return isOnHoldByTransactionID(transactionID);
            }
            return violation.type === CONST.VIOLATION_TYPES.VIOLATION && (showInReview === undefined || showInReview === (violation.showInReview ?? false));
        });
    }

    Result

    Screen.Recording.2024-11-13.at.15.13.33.mov

    What alternative solutions did you explore? (Optional)

  10. Shahidullah-Muffakir commented on Nov 13, 2024

    @Shahidullah-Muffakir
    Contributor

    Edited by proposal-police: This proposal was edited at 2024-11-14 00:27:46 UTC.

    Proposal

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

    When approver unhold an expense the hold status is not updating in the employee UI

    What is the root cause of that problem?

    the unholdMoneyRequestOnSearch is not removing the hold violation for the current transaction for optimisticData and successData :

    function unholdMoneyRequestOnSearch(hash: number, transactionIDList: string[]) {

    like we do in the :unholdRequest

    App/src/libs/actions/IOU.ts

    Lines 7859 to 7863 in fe140c7

    {
    onyxMethod: Onyx.METHOD.SET,
    key: `${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${transactionID}`,
    value: transactionViolations?.filter((violation) => violation.name !== CONST.VIOLATIONS.HOLD) ?? [],
    },

    and

    App/src/libs/actions/IOU.ts

    Lines 7866 to 7876 in fe140c7

    const successData: OnyxUpdate[] = [
    {
    onyxMethod: Onyx.METHOD.MERGE,
    key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`,
    value: {
    pendingAction: null,
    comment: {
    hold: null,
    },
    },
    },

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

    for unholdMoneyRequestOnSearch , we can do same like unholdRequest add this in the optimisticData ,
    add

    {
               onyxMethod: Onyx.METHOD.SET,
               key: `${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${transactionID}`,
               value: transactionViolations?.filter((violation) => violation.name !== CONST.VIOLATIONS.HOLD) ?? [],
           },
    

    and also

         const successData: OnyxUpdate[] = [
          {
              onyxMethod: Onyx.METHOD.MERGE,
              key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`,
              value: {
                  pendingAction: null,
                  comment: {
                      hold: null,
                  },
              },
          },
      ];
    

    What alternative solutions did you explore? (Optional)

    we can add one more check next to the hasViolations in the :

    const shouldShowRBR = hasNoticeTypeViolations || hasViolations || hasFieldErrors || (!isFullySettled && !isFullyApproved && isOnHold) || hasDuplicates;

    if the shouldShowHoldMessage is false, then there should be some violations other than of type hold.

    const hasViolationOtherThanHold = violations?.some((violation) => violation.name !== CONST.VIOLATIONS.HOLD);
    

    and then use it in the shouldShowRBR as:
    const shouldShowRBR =.. || (hasViolations && (hasViolationOtherThanHold ||shouldShowHoldMessage)) ||

  11. greg-schroeder commented on Nov 15, 2024

    @greg-schroeder
    Contributor

    Next up is proposal review

  12. 75 remaining items

  13. greg-schroeder commented on Apr 29, 2025

    @greg-schroeder
    Contributor

    Pending volunteer

  14. greg-schroeder commented on May 12, 2025

    @greg-schroeder
    Contributor

    Pending volunteer

  15. greg-schroeder commented on May 21, 2025

    @greg-schroeder
    Contributor

    Same as above

  16. greg-schroeder commented on Jun 3, 2025

    @greg-schroeder
    Contributor

    I'm going to close this for inactivity for now as it's more than 6 months old. Please comment or reopen if you disagree.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugHot PickInternalWeekly

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions