Skip to content

Commit 17fdf50

Browse files
authored
Merge pull request #35529 from abzokhattab/show-participant-name-in-non-reimbursable-transactions
Show participant name in non reimbursable transactions
2 parents d6c5b83 + 85f2dc1 commit 17fdf50

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/components/ReportActionItem/ReportPreview.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ function ReportPreview({
203203
if (isApproved) {
204204
return translate('iou.managerApproved', {manager: payerOrApproverName});
205205
}
206-
const managerName = isPolicyExpenseChat ? ReportUtils.getPolicyName(chatReport) : ReportUtils.getDisplayNameForParticipant(managerID, true);
206+
const managerName = isPolicyExpenseChat && !hasNonReimbursableTransactions ? ReportUtils.getPolicyName(chatReport) : ReportUtils.getDisplayNameForParticipant(managerID, true);
207207
let paymentVerb: TranslationPaths = hasNonReimbursableTransactions ? 'iou.payerSpent' : 'iou.payerOwes';
208208
if (iouSettled || iouReport?.isWaitingOnBankAccount) {
209209
paymentVerb = 'iou.payerPaid';

src/libs/ReportUtils.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1946,7 +1946,8 @@ function getMoneyRequestReportName(report: OnyxEntry<Report>, policy: OnyxEntry<
19461946

19471947
const moneyRequestTotal = getMoneyRequestSpendBreakdown(report).totalDisplaySpend;
19481948
const formattedAmount = CurrencyUtils.convertToDisplayString(moneyRequestTotal, report?.currency, hasOnlyDistanceRequestTransactions(report?.reportID));
1949-
const payerOrApproverName = isExpenseReport(report) ? getPolicyName(report, false, policy) : getDisplayNameForParticipant(report?.managerID) ?? '';
1949+
const payerOrApproverName =
1950+
isExpenseReport(report) && !hasNonReimbursableTransactions(report?.reportID ?? '') ? getPolicyName(report, false, policy) : getDisplayNameForParticipant(report?.managerID) ?? '';
19501951
const payerPaidAmountMessage = Localize.translateLocal('iou.payerPaidAmount', {
19511952
payer: payerOrApproverName,
19521953
amount: formattedAmount,
@@ -2244,9 +2245,10 @@ function getReportPreviewMessage(
22442245
}
22452246
}
22462247

2248+
const containsNonReimbursable = hasNonReimbursableTransactions(report.reportID);
22472249
const totalAmount = getMoneyRequestSpendBreakdown(report).totalDisplaySpend;
22482250
const policyName = getPolicyName(report, false, policy);
2249-
const payerName = isExpenseReport(report) ? policyName : getDisplayNameForParticipant(report.managerID, !isPreviewMessageForParentChatReport);
2251+
const payerName = isExpenseReport(report) && !containsNonReimbursable ? policyName : getDisplayNameForParticipant(report.managerID, !isPreviewMessageForParentChatReport);
22502252

22512253
const formattedAmount = CurrencyUtils.convertToDisplayString(totalAmount, report.currency);
22522254

0 commit comments

Comments
 (0)