Skip to content

[Due for payment 2026-06-01] [$250] WS Chat - Reacting to Expensify card system message causes it to disappear #89140

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.3.64-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://test-management.browserstack.com/projects/2219752/test-runs/TR-23127/folder/13176890/41237378/1372513429
Email or phone of affected tester (no customers): applausetester+bm89001@applause.expensifail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Web, android
App Component: Workspace Settings

Action Performed:

Preconditions:
Admin has issued a virtual Expensify Card for themselves

  1. Go to staging.new.expensify.com
  2. Navigate to the workspace chat containing the system message for the issued card.
  3. React to the system message with any emoji.

Expected Result:

System message should remain visible after adding an emoji reaction.

Actual Result:

System message disappears from the chat after reacting

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7140201_1777383876389.bandicam_2026-04-28_16-35-22-777.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~022054385395514586352
  • Upwork Job ID: 2054385395514586352
  • Last Price Increase: 2026-05-13
Issue OwnerCurrent Issue Owner: @mallenexpensify

Activity

  1. added
    Bug
    and removed on May 13, 2026
  2. MelvinBot commented on May 13, 2026

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    Card system messages (e.g. CARD_ISSUED_VIRTUAL) have an empty message array by design — their display text is computed client-side from originalMessage via getCardIssuedMessage.

    When a user adds an emoji reaction, the server response can merge updated report action data back into Onyx. Because the message field is [], isDeletedAction treats it as a deleted comment (line 222: message.length === 0), and shouldReportActionBeVisible returns false, hiding the message.

    Other action types with empty messages by design are already exempted at lines 206-212 (REIMBURSEMENT_DIRECTOR_INFORMATION_REQUIRED, CREATED_REPORT_FOR_UNAPPROVED_TRANSACTIONS, REASSIGN_APPROVER), but card action types are not.

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

    Add card-issued action types to the exemption in isDeletedAction in ReportActionsUtils.ts. The existing isCardIssuedAction helper (line 4320) already groups the relevant types (CARD_ISSUED, CARD_ISSUED_VIRTUAL, CARD_MISSING_ADDRESS, CARD_ASSIGNED, CARD_REPLACED_VIRTUAL, CARD_REPLACED), so the fix is to add isCardIssuedAction(reportAction) to the early-return block alongside the other exemptions.

    What alternative solutions did you explore? (Optional)

    An alternative would be to ensure the server populates the message field for card actions, but that would be a backend change and these actions are intentionally designed to compute display text client-side. The exemption approach is consistent with how other empty-message action types are already handled.


    Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot <your feedback> to refine this analysis, or explain why you are rejecting Melvin's proposal.

  3. added
    External
    on May 13, 2026
  4. added
    Help Wanted
    on May 13, 2026
  5. melvin-bot commented on May 13, 2026

    @melvin-bot

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

  6. changed the title [-]WS Chat - Reacting to Expensify card system message causes it to disappear[/-] [+][$250] WS Chat - Reacting to Expensify card system message causes it to disappear[/+] on May 13, 2026
  7. melvin-bot commented on May 13, 2026

    @melvin-bot
  8. KJ21-ENG commented on May 13, 2026

    @KJ21-ENG
    Contributor

    Proposal

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

    Reacting to an Expensify Card system message in a workspace chat makes that system message disappear from the report timeline.

    What is the root cause of that problem?

    The card system action is rendered by its actionName, not by a normal comment body: PureReportActionItem routes card-issued actions to IssueCardMessage, and that component builds the visible text from getCardIssuedMessage(...) using the action's originalMessage fields.

    } else if (isCardIssuedAction(action)) {
    children = (
    <IssueCardMessage
    action={action}
    policyID={report?.policyID}
    />
    );

    <RenderHTML
    html={`<muted-text>${getCardIssuedMessage({reportAction: action, shouldRenderHTML: true, shouldNavigateToCardDetails, policyID, expensifyCard, companyCard, translate})}</muted-text>`}
    />

    function getCardIssuedMessage({
    reportAction,
    shouldRenderHTML = false,
    shouldNavigateToCardDetails = false,
    policyID = '-1',
    expensifyCard,
    companyCard,
    translate,
    }: {
    reportAction: OnyxEntry<ReportAction>;
    shouldRenderHTML?: boolean;
    shouldNavigateToCardDetails?: boolean;
    policyID?: string;
    expensifyCard?: Card;
    companyCard?: Card;
    translate: LocaleContextProps['translate'];
    }) {
    const cardIssuedActionOriginalMessage = isCardIssuedAction(reportAction) ? getOriginalMessage(reportAction) : undefined;
    const assigneeAccountID = cardIssuedActionOriginalMessage?.assigneeAccountID ?? CONST.DEFAULT_NUMBER_ID;
    const cardID = cardIssuedActionOriginalMessage?.cardID ?? CONST.DEFAULT_NUMBER_ID;
    const assignee = shouldRenderHTML ? `<mention-user accountID="${assigneeAccountID}"/>` : Parser.htmlToText(`<mention-user accountID="${assigneeAccountID}"/>`);
    const navigateRoute = shouldNavigateToCardDetails ? ROUTES.EXPENSIFY_CARD_DETAILS.getRoute(policyID, String(cardID)) : ROUTES.SETTINGS_DOMAIN_CARD_DETAIL.getRoute(String(cardID));
    const isExpensifyCardActive = isCardActive(expensifyCard);
    const expensifyCardLink = (expensifyCardLinkText: string) =>
    shouldRenderHTML && isExpensifyCardActive ? `<a href='${environmentURL}/${navigateRoute}'>${expensifyCardLinkText}</a>` : expensifyCardLinkText;
    const isAssigneeCurrentUser = deprecatedCurrentUserAccountID === assigneeAccountID;
    const companyCardLink =
    shouldRenderHTML && isAssigneeCurrentUser && companyCard
    ? `<a href='${environmentURL}/${ROUTES.SETTINGS_WALLET}'>${translate('workspace.companyCards.companyCard')}</a>`
    : translate('workspace.companyCards.companyCard');
    switch (reportAction?.actionName) {
    case CONST.REPORT.ACTIONS.TYPE.CARD_ISSUED: {
    if (cardIssuedActionOriginalMessage?.hadMissingAddress) {
    return translate('workspace.expensifyCard.addedShippingDetails', assignee);
    }
    return translate('workspace.expensifyCard.issuedCard', assignee);
    }
    case CONST.REPORT.ACTIONS.TYPE.CARD_ISSUED_VIRTUAL:
    return translate('workspace.expensifyCard.issuedCardVirtual', assignee, expensifyCardLink(translate('workspace.expensifyCard.card')));
    case CONST.REPORT.ACTIONS.TYPE.CARD_ASSIGNED:
    return translate('workspace.companyCards.assignedCard', assignee, companyCardLink);
    case CONST.REPORT.ACTIONS.TYPE.CARD_MISSING_ADDRESS:
    return translate('workspace.expensifyCard.issuedCardNoShippingDetails', assignee);
    case CONST.REPORT.ACTIONS.TYPE.CARD_REPLACED_VIRTUAL:
    return translate('workspace.expensifyCard.replacedVirtualCard', assignee, expensifyCardLink(translate('workspace.expensifyCard.replacementCard')));
    case CONST.REPORT.ACTIONS.TYPE.CARD_REPLACED:
    return translate('workspace.expensifyCard.replacedCard', assignee);
    default:
    return '';
    }
    }

    After adding the emoji reaction, the action is re-evaluated for timeline visibility. shouldReportActionBeVisible() hides any non-pending action when isDeletedAction() returns true, and isDeletedAction() currently treats message.length === 0 as a legacy deleted comment. That works for normal comments, but it is wrong for Expensify Card system actions whose display text is derived from originalMessage instead of message.

    function isDeletedAction(reportAction: OnyxInputOrEntry<ReportAction | OptimisticIOUReportAction>): boolean {
    if (isInviteOrRemovedAction(reportAction) || isActionableMentionWhisper(reportAction) || isActionableCardFraudAlert(reportAction)) {
    return false;
    }
    if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.HOLD || reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.UNHOLD) {
    return false;
    }
    // for report actions with this type we get an empty array as message by design
    if (
    reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_DIRECTOR_INFORMATION_REQUIRED ||
    reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.CREATED_REPORT_FOR_UNAPPROVED_TRANSACTIONS ||
    reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.REASSIGN_APPROVER
    ) {
    return false;
    }
    const message = reportAction?.message ?? [];
    if (!Array.isArray(message)) {
    return message?.html === '' || !!message?.deleted;
    }
    const originalMessage = getOriginalMessage(reportAction);
    // A legacy deleted comment has either an empty array or an object with html field with empty string as value
    const isLegacyDeletedComment = message.length === 0 || message.at(0)?.html === '';
    return isLegacyDeletedComment || !!message.at(0)?.deleted || (!!originalMessage && typeof originalMessage === 'object' && 'deleted' in originalMessage && !!originalMessage?.deleted);
    }

    if (!isVisiblePreviewOrMoneyRequest(reportAction)) {
    return false;
    }
    // All other actions are displayed except thread parents, deleted, or non-pending actions
    return !!reportAction.pendingAction || !isDeletedAction(reportAction) || isDeletedParentAction(reportAction) || isReversedTransaction(reportAction);

    The existing empty-message allowlist already exempts several system actions that intentionally have no normal message body, but it does not include the card-issued action family even though isCardIssuedAction() already groups those action names.

    // for report actions with this type we get an empty array as message by design
    if (
    reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_DIRECTOR_INFORMATION_REQUIRED ||
    reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.CREATED_REPORT_FOR_UNAPPROVED_TRANSACTIONS ||
    reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.REASSIGN_APPROVER
    ) {
    return false;
    }

    function isCardIssuedAction(
    reportAction: OnyxEntry<ReportAction>,
    ): reportAction is ReportAction<
    | typeof CONST.REPORT.ACTIONS.TYPE.CARD_ISSUED
    | typeof CONST.REPORT.ACTIONS.TYPE.CARD_ISSUED_VIRTUAL
    | typeof CONST.REPORT.ACTIONS.TYPE.CARD_MISSING_ADDRESS
    | typeof CONST.REPORT.ACTIONS.TYPE.CARD_ASSIGNED
    | typeof CONST.REPORT.ACTIONS.TYPE.CARD_REPLACED_VIRTUAL
    | typeof CONST.REPORT.ACTIONS.TYPE.CARD_REPLACED
    > {
    return (
    isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.CARD_ISSUED) ||
    isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.CARD_ISSUED_VIRTUAL) ||
    isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.CARD_MISSING_ADDRESS) ||
    isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.CARD_ASSIGNED) ||
    isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.CARD_REPLACED_VIRTUAL) ||
    isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.CARD_REPLACED)
    );
    }

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

    Update isDeletedAction() so card-issued system actions are not classified as deleted solely because their message array is empty. Reuse the existing isCardIssuedAction(reportAction) helper in the same early-return block that already handles other intentionally empty-message system actions.

    Add a regression test in tests/unit/ReportActionsUtilsTest.ts for a CARD_ISSUED_VIRTUAL (and/or one representative card-issued action from isCardIssuedAction) with message: [] and an originalMessage containing assigneeAccountID and cardID, asserting that isDeletedAction() is false and shouldReportActionBeVisible() remains true.

    Scope boundaries:

    • Files touched: src/libs/ReportActionsUtils.ts — isDeletedAction() empty-message exemption; tests/unit/ReportActionsUtilsTest.ts — card system action visibility regression coverage.
    • Platforms: all platforms using the shared report-action visibility pipeline.
    • Code paths / callers explicitly NOT touched: emoji reaction optimistic writes in src/libs/actions/Report/index.ts, IssueCardMessage rendering, getCardIssuedMessage, backend AddEmojiReaction response handling.
    • API contracts or backend behavior changes: no.

    What alternative solutions did you explore? (Optional)

    MelvinBot proposed the same client-side exemption. I agree with that direction because it fixes the visibility predicate at the shared boundary where the action is incorrectly treated as deleted.

    I also considered forcing the emoji reaction flow or backend response to preserve/populate message, but that would make card system actions depend on duplicated display text even though the existing client rendering intentionally derives their copy from originalMessage via getCardIssuedMessage().

  9. 24 remaining items

  10. melvin-bot commented on May 29, 2026

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (Awaiting Payment)

  11. melvin-bot commented on May 31, 2026

    @melvin-bot

    Payment Summary

    Upwork Job

    BugZero Checklist (@mallenexpensify)

    • I have verified the correct assignees and roles are listed above and updated the necessary manual offers
    • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants/2054385395514586352/hired)
    • I have verified the PR was not reverted
    • I have applied any discounts due to bugs/regressions introduced by this PR
    • I have paid out the Upwork contracts or cancelled the ones that are incorrect
    • I have verified the payment summary above is correct
  12. melvin-bot commented on Jun 1, 2026

    @melvin-bot

    @mallenexpensify Whoops! This issue is 2 days overdue. Let's get this updated quick!

  13. mallenexpensify commented on Jun 2, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor+: @ahmedGaber93 due $250 via NewDot

    @ahmedGaber93 plz complete the BZ checklist and tag me in a post once you have. Thx

  14. ahmedGaber93 commented on Jun 3, 2026

    @ahmedGaber93
    Contributor

    BugZero Checklist:

    • [Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

      Link to the comment on the PR: N/A. No clear offending PR was identified. The root cause appears to be BE, but we're applying a FE fix since the BE behavior is correct and the issue stems from a mismatch with FE expectations.

      Link to the comment on the Issue: N/A.

    • [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: N/A

    • [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.

    This is a straightforward fix, so I don’t think we need a regression test here.

  15. ahmedGaber93 commented on Jun 3, 2026

    @ahmedGaber93
    Contributor

    @mallenexpensify checklist have been completed, sorry for the delay.

  16. mallenexpensify commented on Jun 3, 2026

    @mallenexpensify
    Contributor

    Came from a regression test, no update needed.

  17. flaviadefaria commented on Jul 31, 2026

    @flaviadefaria
    Contributor

    Approved: @ahmedGaber93 due $250 via NewDot

  18. melvin-bot commented on Oct 13, 2026

    @melvin-bot

    ⚠️ Looks like this issue was linked to a Deploy Blocker here

    If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

    If a regression has occurred and you are the assigned CM follow the instructions here.

    If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

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