Skip to content

Commit 1415373

Browse files
AndrewGableOSBotify
authored andcommitted
Merge pull request #88004 from Expensify/scott-dryUpClipboardMessage
Expand fallback condition & DRY up message for clipboard copy (cherry picked from commit e12021e) (cherry-picked to staging by AndrewGable)
1 parent b2fba10 commit 1415373

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/libs/ReportActionsUtils.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -448,8 +448,12 @@ function getReimbursedMessage(translate: LocalizedTranslate, reportAction: OnyxI
448448
// Real-time Pusher updates only carry `method`, so we fall back to it here for compatibility.
449449
const effectivePaymentMethod = originalMessage?.paymentMethod ?? originalMessage?.method;
450450

451-
// If no structured data, fall back to message fragments from backend (old actions)
452-
if (!effectivePaymentMethod || !originalMessage) {
451+
// If no structured data, or if this is a Pusher-only payload for a payment method that requires
452+
// bank account digits (ACH, Fast_ACH, StripeConnect) but `creditBankAccountLast4` hasn't been
453+
// populated yet by the openReport path, fall back to the pre-formatted server message fragments
454+
// which already contain the correct account info. Check payments don't need enriched fields, so
455+
// they are excluded from this fallback.
456+
if (!effectivePaymentMethod || !originalMessage || (!originalMessage.paymentMethod && effectivePaymentMethod !== 'Check' && !originalMessage.creditBankAccountLast4)) {
453457
const messageFragments = reportAction?.message;
454458
let fallback = getReportActionMessageText(reportAction as OnyxEntry<ReportAction>);
455459
if (Array.isArray(messageFragments) && messageFragments.length > 1) {

src/pages/inbox/report/ContextMenu/ContextMenuActions.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,13 @@ import {
7373
getPolicyChangeLogMaxExpenseAmountMessage,
7474
getPolicyChangeLogMaxExpenseAmountNoReceiptMessage,
7575
getPolicyChangeLogUpdateEmployee,
76-
getReimbursedMessage,
7776
getReimburserUpdateMessage,
7877
getRemovedCardFeedMessage,
7978
getRemovedConnectionMessage,
8079
getRenamedAction,
8180
getRenamedCardFeedMessage,
8281
getReportAction,
82+
getReportActionMessageFragments,
8383
getReportActionMessageText,
8484
getRoomAvatarUpdatedMessage,
8585
getSetAutoJoinMessage,
@@ -965,7 +965,7 @@ const ContextMenuActions: ContextMenuAction[] = [
965965
} else if (isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.MARKED_REIMBURSED)) {
966966
Clipboard.setString(getMarkedReimbursedMessage(translate, reportAction));
967967
} else if (isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.REIMBURSED)) {
968-
Clipboard.setString(getReimbursedMessage(translate, reportAction, report, currentUserPersonalDetails?.accountID ?? CONST.DEFAULT_NUMBER_ID));
968+
Clipboard.setString(getReportActionMessageFragments(translate, reportAction).at(0)?.text ?? '');
969969
} else if (isReimbursementQueuedAction(reportAction)) {
970970
Clipboard.setString(
971971
getReimbursementQueuedActionMessage({reportAction, translate, formatPhoneNumber: formatPhoneNumberPhoneUtils, report, shouldUseShortDisplayName: false}),

0 commit comments

Comments
 (0)