Skip to content

Commit

Permalink
Add support for REJECTED report message text everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
youssef-lr committed Sep 1, 2024
1 parent 2d5a575 commit bd1a3f1
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,7 @@ export default {
payerSettled: ({amount}: PayerSettledParams) => `paid ${amount}`,
approvedAmount: ({amount}: ApprovedAmountParams) => `approved ${amount}`,
forwardedAmount: ({amount}: ForwardedAmountParams) => `approved ${amount}`,
rejectedThisReport: 'rejected this report',
waitingOnBankAccount: ({submitterDisplayName}: WaitingOnBankAccountParams) => `started settling up. Payment is on hold until ${submitterDisplayName} adds a bank account.`,
adminCanceledRequest: ({manager, amount}: AdminCanceledRequestParams) => `${manager ? `${manager}: ` : ''}cancelled the ${amount} payment.`,
canceledRequest: ({amount, submitterDisplayName}: CanceledRequestParams) =>
Expand Down
1 change: 1 addition & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,7 @@ export default {
payerSettled: ({amount}: PayerSettledParams) => `pagó ${amount}`,
approvedAmount: ({amount}: ApprovedAmountParams) => `aprobó ${amount}`,
forwardedAmount: ({amount}: ForwardedAmountParams) => `aprobó ${amount}`,
rejectedThisReport: '// TODO',
waitingOnBankAccount: ({submitterDisplayName}: WaitingOnBankAccountParams) => `inició el pago, pero no se procesará hasta que ${submitterDisplayName} añada una cuenta bancaria`,
adminCanceledRequest: ({manager, amount}: AdminCanceledRequestParams) => `${manager ? `${manager}: ` : ''}canceló el pago de ${amount}.`,
canceledRequest: ({amount, submitterDisplayName}: CanceledRequestParams) =>
Expand Down
2 changes: 2 additions & 0 deletions src/libs/OptionsListUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,8 @@ function getLastMessageTextForReport(report: OnyxEntry<Report>, lastActorDetails
lastMessageTextFromReport = ReportUtils.getIOUApprovedMessage(lastReportAction);
} else if (lastReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.FORWARDED) {
lastMessageTextFromReport = ReportUtils.getIOUForwardedMessage(lastReportAction, report);
} else if (lastReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.REJECTED) {
lastMessageTextFromReport = ReportUtils.getRejectedReportMessage();
} else if (ReportActionUtils.isActionableAddPaymentCard(lastReportAction)) {
lastMessageTextFromReport = ReportActionUtils.getReportActionMessageText(lastReportAction);
} else if (lastReportAction?.actionName === 'EXPORTINTEGRATION') {
Expand Down
8 changes: 8 additions & 0 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3673,6 +3673,9 @@ function getReportName(
if (parentReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.FORWARDED) {
return getIOUForwardedMessage(parentReportAction, report);
}
if (parentReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.REJECTED) {
return getRejectedReportMessage();
}
if (parentReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.APPROVED) {
return getIOUApprovedMessage(parentReportAction);
}
Expand Down Expand Up @@ -4415,6 +4418,10 @@ function getIOUForwardedMessage(reportAction: ReportAction, reportOrID: OnyxInpu
return Localize.translateLocal('iou.forwardedAmount', {amount: formattedAmount});
}

function getRejectedReportMessage() {
return Localize.translateLocal('iou.rejectedThisReport');
}

function getWorkspaceNameUpdatedMessage(action: ReportAction) {
const {oldName, newName} = ReportActionsUtils.getOriginalMessage(action as ReportAction<typeof CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_NAME>) ?? {};
const message = oldName && newName ? Localize.translateLocal('workspaceActions.renamedWorkspaceNameAction', {oldName, newName}) : ReportActionsUtils.getReportActionText(action);
Expand Down Expand Up @@ -7829,6 +7836,7 @@ export {
getIOUReportActionMessage,
getIOUApprovedMessage,
getIOUForwardedMessage,
getRejectedReportMessage,
getWorkspaceNameUpdatedMessage,
getIOUSubmittedMessage,
getIcons,
Expand Down
3 changes: 3 additions & 0 deletions src/pages/home/report/ContextMenu/ContextMenuActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,9 @@ const ContextMenuActions: ContextMenuAction[] = [
} else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.FORWARDED) {
const displayMessage = ReportUtils.getIOUForwardedMessage(reportAction, reportID);
Clipboard.setString(displayMessage);
} else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.REJECTED) {
const displayMessage = ReportUtils.getRejectedReportMessage();
Clipboard.setString(displayMessage);
} else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.HOLD) {
Clipboard.setString(Localize.translateLocal('iou.heldExpense'));
} else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.UNHOLD) {
Expand Down
2 changes: 2 additions & 0 deletions src/pages/home/report/ReportActionItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,8 @@ function ReportActionItem({
children = <ReportActionItemBasicMessage message={ReportUtils.getIOUApprovedMessage(action)} />;
} else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.FORWARDED) {
children = <ReportActionItemBasicMessage message={ReportUtils.getIOUForwardedMessage(action, report)} />;
} else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.REJECTED) {
children = <ReportActionItemBasicMessage message={translate('iou.rejectedThisReport')} />;
} else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.HOLD) {
children = <ReportActionItemBasicMessage message={translate('iou.heldExpense')} />;
} else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.HOLD_COMMENT) {
Expand Down

0 comments on commit bd1a3f1

Please sign in to comment.