Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/CONST/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1579,6 +1579,7 @@ const CONST = {
UPDATE_ADDRESS: 'POLICYCHANGELOG_UPDATE_ADDRESS',
UPDATE_FEATURE_ENABLED: 'POLICYCHANGELOG_UPDATE_FEATURE_ENABLED',
UPDATE_IS_ATTENDEE_TRACKING_ENABLED: 'POLICYCHANGELOG_UPDATE_IS_ATTENDEE_TRACKING_ENABLED',
UPDATE_REQUIRE_COMPANY_CARDS_ENABLED: 'POLICYCHANGELOG_UPDATE_REQUIRE_COMPANY_CARDS_ENABLED',
UPDATE_DEFAULT_APPROVER: 'POLICYCHANGELOG_UPDATE_DEFAULT_APPROVER',
UPDATE_SUBMITS_TO: 'POLICYCHANGELOG_UPDATE_SUBMITS_TO',
UPDATE_FORWARDS_TO: 'POLICYCHANGELOG_UPDATE_FORWARDS_TO',
Expand Down
1 change: 1 addition & 0 deletions src/languages/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7534,6 +7534,7 @@ Fügen Sie weitere Ausgabelimits hinzu, um den Cashflow Ihres Unternehmens zu sc
`Kartenfeed-Tag für das Abrechnungsperiodenende von „${feedName}“ geändert${newValue ? ` in „${newValue}“` : ''}${previousValue ? ` (zuvor „${previousValue}“)` : ''}`,
addedReportField: (fieldType: string, fieldName?: string, defaultValue?: string) =>
`${fieldType}-Berichtsfeld „${fieldName}“${defaultValue ? ` mit Standardwert „${defaultValue}“` : ''} hinzugefügt`,
updatedRequireCompanyCards: ({enabled}: {enabled: boolean}) => `${enabled ? 'aktiviert' : 'deaktiviert'} die Anforderung für Firmenkartenkäufe`,
},
roomMembersPage: {
memberNotFound: 'Mitglied nicht gefunden.',
Expand Down
1 change: 1 addition & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7421,6 +7421,7 @@ const translations = {
}
},
updatedAttendeeTracking: ({enabled}: {enabled: boolean}) => `${enabled ? 'enabled' : 'disabled'} attendee tracking`,
updatedRequireCompanyCards: ({enabled}: {enabled: boolean}) => `${enabled ? 'enabled' : 'disabled'} the company card purchases requirement`,
updatedAutoPayApprovedReports: ({enabled}: {enabled: boolean}) => `${enabled ? 'enabled' : 'disabled'} auto-pay approved reports`,
setAutoPayApprovedReportsLimit: ({newLimit}: {newLimit: string}) => `set the auto-pay approved reports threshold to "${newLimit}"`,
updatedAutoPayApprovedReportsLimit: ({oldLimit, newLimit}: {oldLimit: string; newLimit: string}) =>
Expand Down
1 change: 1 addition & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7287,6 +7287,7 @@ ${amount} para ${merchant} - ${date}`,
}
},
updatedAttendeeTracking: ({enabled}: {enabled: boolean}) => `${enabled ? 'habilitó' : 'deshabilitó'} el seguimiento de asistentes`,
updatedRequireCompanyCards: ({enabled}: {enabled: boolean}) => `${enabled ? 'habilitó' : 'deshabilitó'} el requisito de compras con tarjeta de la empresa`,
updatedAutoPayApprovedReports: ({enabled}: {enabled: boolean}) => `${enabled ? 'habilitó' : 'deshabilitó'} el autopago de informes aprobados`,
setAutoPayApprovedReportsLimit: ({newLimit}: {newLimit: string}) => `estableció el umbral de autopago de informes aprobados en "${newLimit}"`,
updatedAutoPayApprovedReportsLimit: ({oldLimit, newLimit}: {oldLimit: string; newLimit: string}) =>
Expand Down
1 change: 1 addition & 0 deletions src/languages/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7556,6 +7556,7 @@ Ajoutez davantage de règles de dépenses pour protéger la trésorerie de l’e
`a modifié le jour de fin de période de relevé du flux de carte « ${feedName} »${newValue ? ` à « ${newValue} »` : ''}${previousValue ? ` (précédemment « ${previousValue} »)` : ''}`,
addedReportField: (fieldType: string, fieldName?: string, defaultValue?: string) =>
`a ajouté le champ de note de frais ${fieldType} « ${fieldName} »${defaultValue ? ` avec la valeur par défaut « ${defaultValue} »` : ''}`,
updatedRequireCompanyCards: ({enabled}: {enabled: boolean}) => `${enabled ? 'activé' : 'désactivé'} l’exigence d’achats par carte d’entreprise`,
},
roomMembersPage: {
memberNotFound: 'Membre introuvable.',
Expand Down
1 change: 1 addition & 0 deletions src/languages/it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7522,6 +7522,7 @@ Aggiungi altre regole di spesa per proteggere il flusso di cassa aziendale.`,
`ha modificato il giorno di fine periodo dell’estratto conto del flusso carta "${feedName}"${newValue ? ` a "${newValue}"` : ''}${previousValue ? ` (in precedenza "${previousValue}")` : ''}`,
addedReportField: (fieldType: string, fieldName?: string, defaultValue?: string) =>
`aggiunto campo di report ${fieldType} "${fieldName}"${defaultValue ? ` con valore predefinito "${defaultValue}"` : ''}`,
updatedRequireCompanyCards: ({enabled}: {enabled: boolean}) => `${enabled ? 'abilitato' : 'disabilitato'} il requisito per gli acquisti con carta aziendale`,
},
roomMembersPage: {
memberNotFound: 'Membro non trovato.',
Expand Down
1 change: 1 addition & 0 deletions src/languages/ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7432,6 +7432,7 @@ ${reportName}
`カード明細フィード「${feedName}」の利用明細期間の終了日を変更しました${newValue ? ` を「${newValue}」に` : ''}${previousValue ? ` (以前の値:「${previousValue}」)` : ''}`,
addedReportField: (fieldType: string, fieldName?: string, defaultValue?: string) =>
`${fieldType}レポートフィールド「${fieldName}」を追加しました${defaultValue ? ` デフォルト値「${defaultValue}」付き` : ''}`,
updatedRequireCompanyCards: ({enabled}: {enabled: boolean}) => `${enabled ? '有効' : '無効'} の法人カード購入要件`,
},
roomMembersPage: {
memberNotFound: 'メンバーが見つかりません。',
Expand Down
1 change: 1 addition & 0 deletions src/languages/nl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7497,6 +7497,7 @@ er bestedingsregels toe om de kasstroom van het bedrijf te beschermen.`,
`heeft de einddag van de afrekenperiode van kaartfeed "${feedName}" gewijzigd${newValue ? ` naar "${newValue}"` : ''}${previousValue ? ` (voorheen "${previousValue}")` : ''}`,
addedReportField: (fieldType: string, fieldName?: string, defaultValue?: string) =>
`heeft ${fieldType}-rapportveld "${fieldName}" toegevoegd${defaultValue ? ` met standaardwaarde "${defaultValue}"` : ''}`,
updatedRequireCompanyCards: ({enabled}: {enabled: boolean}) => `vereiste ${enabled ? 'ingeschakeld' : 'uitgeschakeld'} voor bedrijfskaarttransacties`,
},
roomMembersPage: {
memberNotFound: 'Lid niet gevonden.',
Expand Down
1 change: 1 addition & 0 deletions src/languages/pl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7488,6 +7488,7 @@ Dodaj więcej zasad wydatków, żeby chronić płynność finansową firmy.`,
`zmienił dzień zakończenia okresu rozliczeniowego dla źródła karty „${feedName}”${newValue ? ` na „${newValue}”` : ''}${previousValue ? ` (wcześniej „${previousValue}”)` : ''}`,
addedReportField: (fieldType: string, fieldName?: string, defaultValue?: string) =>
`dodano pole raportu typu ${fieldType} „${fieldName}”${defaultValue ? ` z domyślną wartością „${defaultValue}”` : ''}`,
updatedRequireCompanyCards: ({enabled}: {enabled: boolean}) => `${enabled ? 'włączone' : 'wyłączone'} wymóg dotyczący zakupów kartą służbową`,
},
roomMembersPage: {
memberNotFound: 'Nie znaleziono członka.',
Expand Down
1 change: 1 addition & 0 deletions src/languages/pt-BR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7489,6 +7489,7 @@ Adicione mais regras de gasto para proteger o fluxo de caixa da empresa.`,
`changed card feed "${feedName}" statement period end day${newValue ? ` para "${newValue}"` : ''}${previousValue ? `(antes " ${previousValue}")` : ''}`,
addedReportField: (fieldType: string, fieldName?: string, defaultValue?: string) =>
`adicionou o campo de relatório ${fieldType} "${fieldName}"${defaultValue ? ` com valor padrão "${defaultValue}"` : ''}`,
updatedRequireCompanyCards: ({enabled}: {enabled: boolean}) => `${enabled ? 'ativado' : 'desativado'} o requisito de compras com cartão corporativo`,
},
roomMembersPage: {
memberNotFound: 'Membro não encontrado.',
Expand Down
1 change: 1 addition & 0 deletions src/languages/zh-hans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7296,6 +7296,7 @@ ${reportName}
updatedCardFeedStatementPeriod: (feedName: string, newValue?: string, previousValue?: string) =>
`已更改卡片流水“${feedName}”的账单周期截止日${newValue ? ` 为“${newValue}”` : ''}${previousValue ? ` (先前为“${previousValue}”)` : ''}`,
addedReportField: (fieldType: string, fieldName?: string, defaultValue?: string) => `已添加 ${fieldType} 报告字段“${fieldName}”${defaultValue ? ` 默认值为“${defaultValue}”` : ''}`,
updatedRequireCompanyCards: ({enabled}: {enabled: boolean}) => `${enabled ? '已启用' : '已禁用'} 公司商务卡消费要求`,
},
roomMembersPage: {
memberNotFound: '未找到成员。',
Expand Down
4 changes: 4 additions & 0 deletions src/libs/OptionsListUtils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ import {
getReportActionActorAccountID,
getReportActionHtml,
getReportActionMessageText,
getRequireCompanyCardsEnabledMessage,
getRoomAvatarUpdatedMessage,
getRoomChangeLogMessage,
getSortedReportActions,
Expand Down Expand Up @@ -879,6 +880,9 @@ function getLastMessageTextForReport({
if (isActionOfType(lastReportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_AUTO_PAY_APPROVED_REPORTS_ENABLED)) {
lastMessageTextFromReport = getAutoPayApprovedReportsEnabledMessage(translate, lastReportAction);
}
if (isActionOfType(lastReportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_REQUIRE_COMPANY_CARDS_ENABLED)) {
lastMessageTextFromReport = getRequireCompanyCardsEnabledMessage(translate, lastReportAction);
}
if (isActionOfType(lastReportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_AUTO_REIMBURSEMENT)) {
lastMessageTextFromReport = getAutoReimbursementMessage(translate, lastReportAction);
}
Expand Down
7 changes: 7 additions & 0 deletions src/libs/ReportActionsUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3441,6 +3441,12 @@ function getWorkspaceAttendeeTrackingUpdateMessage(translate: LocalizedTranslate
return translate('workspaceActions.updatedAttendeeTracking', {enabled: !!enabled});
}

function getRequireCompanyCardsEnabledMessage(translate: LocalizedTranslate, action: ReportAction): string {
const {enabled} = getOriginalMessage(action as ReportAction<typeof CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_REQUIRE_COMPANY_CARDS_ENABLED>) ?? {};

return translate('workspaceActions.updatedRequireCompanyCards', {enabled: !!enabled});
}

function getAutoPayApprovedReportsEnabledMessage(translate: LocalizedTranslate, action: ReportAction): string {
const {enabled} = getOriginalMessage(action as ReportAction<typeof CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_AUTO_PAY_APPROVED_REPORTS_ENABLED>) ?? {};

Expand Down Expand Up @@ -4704,6 +4710,7 @@ export {
getWorkspaceUpdateFieldMessage,
getWorkspaceFeatureEnabledMessage,
getWorkspaceAttendeeTrackingUpdateMessage,
getRequireCompanyCardsEnabledMessage,
getAutoPayApprovedReportsEnabledMessage,
getAutoReimbursementMessage,
formatAddressToString,
Expand Down
5 changes: 5 additions & 0 deletions src/libs/ReportNameUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ import {
getReportAction,
getReportActionMessage as getReportActionMessageFromActionsUtils,
getReportActionText,
getRequireCompanyCardsEnabledMessage,
getSettlementAccountLockedMessage,
getSubmitsToUpdateMessage,
getTravelUpdateMessage,
Expand Down Expand Up @@ -773,6 +774,10 @@ function computeReportNameBasedOnReportAction(
if (isActionOfType(parentReportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_CARD_FEED_STATEMENT_PERIOD)) {
return getUpdatedCardFeedStatementPeriodMessage(translate, parentReportAction);
}
if (isActionOfType(parentReportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_REQUIRE_COMPANY_CARDS_ENABLED)) {
return getRequireCompanyCardsEnabledMessage(translate, parentReportAction);
}

if (isDynamicExternalWorkflowSubmitFailedAction(parentReportAction)) {
return getDynamicExternalWorkflowSubmitFailedActionMessage(translate, parentReportAction);
}
Expand Down
3 changes: 3 additions & 0 deletions src/libs/SidebarUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ import {
getReportAction,
getReportActionActorAccountID,
getReportActionMessageText,
getRequireCompanyCardsEnabledMessage,
getRoomAvatarUpdatedMessage,
getSetAutoJoinMessage,
getSettlementAccountLockedMessage,
Expand Down Expand Up @@ -1075,6 +1076,8 @@ function getOptionData({
result.alternateText = getWorkspaceFeatureEnabledMessage(translate, lastAction);
} else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_IS_ATTENDEE_TRACKING_ENABLED) {
result.alternateText = getWorkspaceAttendeeTrackingUpdateMessage(translate, lastAction);
} else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_REQUIRE_COMPANY_CARDS_ENABLED) {
result.alternateText = getRequireCompanyCardsEnabledMessage(translate, lastAction);
} else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_AUTO_PAY_APPROVED_REPORTS_ENABLED) {
result.alternateText = getAutoPayApprovedReportsEnabledMessage(translate, lastAction);
} else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_AUTO_REIMBURSEMENT) {
Expand Down
3 changes: 3 additions & 0 deletions src/pages/inbox/report/ContextMenu/ContextMenuActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ import {
getReportAction,
getReportActionMessageFragments,
getReportActionMessageText,
getRequireCompanyCardsEnabledMessage,
getRoomAvatarUpdatedMessage,
getSetAutoJoinMessage,
getSettlementAccountLockedMessage,
Expand Down Expand Up @@ -958,6 +959,8 @@ const ContextMenuActions: ContextMenuAction[] = [
Clipboard.setString(getForwardsToUpdateMessage(translate, reportAction));
} else if (reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_AUTO_PAY_APPROVED_REPORTS_ENABLED) {
Clipboard.setString(getAutoPayApprovedReportsEnabledMessage(translate, reportAction));
} else if (reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_REQUIRE_COMPANY_CARDS_ENABLED) {
Clipboard.setString(getRequireCompanyCardsEnabledMessage(translate, reportAction));
} else if (reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_AUTO_REIMBURSEMENT) {
Clipboard.setString(getAutoReimbursementMessage(translate, reportAction));
} else if (reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_INVOICE_COMPANY_NAME) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import {
getRemovedCardFeedMessage,
getRemovedConnectionMessage,
getRenamedCardFeedMessage,
getRequireCompanyCardsEnabledMessage,
getSetAutoJoinMessage,
getSubmitsToUpdateMessage,
getTagListNameUpdatedMessage,
Expand Down Expand Up @@ -133,6 +134,7 @@ const POLICY_CHANGE_LOG_RESOLVERS: Record<string, ResolverFn> = {
[CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_FIELD]: (translate, action) => getWorkspaceUpdateFieldMessage(translate, action),
[CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_FEATURE_ENABLED]: (translate, action) => getWorkspaceFeatureEnabledMessage(translate, action),
[CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_IS_ATTENDEE_TRACKING_ENABLED]: (translate, action) => getWorkspaceAttendeeTrackingUpdateMessage(translate, action),
[CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_REQUIRE_COMPANY_CARDS_ENABLED]: (translate, action) => getRequireCompanyCardsEnabledMessage(translate, action),
[CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_DEFAULT_APPROVER]: (translate, action) => getDefaultApproverUpdateMessage(translate, action),
[CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_SUBMITS_TO]: (translate, action) => getSubmitsToUpdateMessage(translate, action),
[CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_FORWARDS_TO]: (translate, action) => getForwardsToUpdateMessage(translate, action),
Expand Down
23 changes: 23 additions & 0 deletions tests/unit/OptionsListUtilsTest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ import {
getForeignCurrencyDefaultTaxUpdateMessage,
getRemovedCardFeedMessage,
getRenamedCardFeedMessage,
getRequireCompanyCardsEnabledMessage,
getUnassignedCompanyCardMessage,
getUpdatedCardFeedLiabilityMessage,
getUpdatedCardFeedStatementPeriodMessage,
Expand Down Expand Up @@ -4324,6 +4325,28 @@ describe('OptionsListUtils', () => {
});
expect(lastMessage).toBe(getForeignCurrencyDefaultTaxUpdateMessage(translateLocal, action));
});
it('UPDATE_REQUIRE_COMPANY_CARDS_ENABLED action', async () => {
const report: Report = createRandomReport(0, undefined);
const action: ReportAction = {
...createRandomReportAction(1),
actionName: CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_REQUIRE_COMPANY_CARDS_ENABLED,
message: [{type: 'COMMENT', text: ''}],
originalMessage: {enabled: true},
};
await Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report.reportID}`, {
[action.reportActionID]: action,
});
const lastMessage = getLastMessageTextForReport({
translate: translateLocal,
report,
lastActorDetails: null,
policy: undefined,
isReportArchived: false,

currentUserLogin: CURRENT_USER_EMAIL,
});
expect(lastMessage).toBe(getRequireCompanyCardsEnabledMessage(translateLocal, action));
});
it('ADD_CARD_FEED action', async () => {
const report: Report = createRandomReport(0, undefined);
const action: ReportAction = {
Expand Down
33 changes: 33 additions & 0 deletions tests/unit/ReportActionsUtilsTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import {
getRemovedCardFeedMessage,
getRenamedCardFeedMessage,
getReportActionActorAccountID,
getRequireCompanyCardsEnabledMessage,
getSendMoneyFlowAction,
getSortedReportActions,
getSortedReportActionsForDisplay,
Expand Down Expand Up @@ -4293,6 +4294,38 @@ describe('ReportActionsUtils', () => {
});
});

describe('getRequireCompanyCardsEnabledMessage', () => {
it('should return enabled message when the company card requirement is enabled', () => {
const action = {
actionName: CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_REQUIRE_COMPANY_CARDS_ENABLED,
reportActionID: '1',
created: '',
originalMessage: {
enabled: true,
},
message: [],
} as ReportAction;

const result = getRequireCompanyCardsEnabledMessage(translateLocal, action);
expect(result).toBe('enabled the company card purchases requirement');
});

it('should return disabled message when the company card requirement is disabled', () => {
const action = {
actionName: CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_REQUIRE_COMPANY_CARDS_ENABLED,
reportActionID: '1',
created: '',
originalMessage: {
enabled: false,
},
message: [],
} as ReportAction;

const result = getRequireCompanyCardsEnabledMessage(translateLocal, action);
expect(result).toBe('disabled the company card purchases requirement');
});
});

describe('getAutoReimbursementMessage', () => {
it('should return set message when setting limit for the first time from zero', () => {
const action = {
Expand Down
Loading
Loading