Skip to content
Open
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
6 changes: 4 additions & 2 deletions src/components/ReportActionItem/ExportIntegration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import {View} from 'react-native';
import type {OnyxEntry} from 'react-native-onyx';
import Text from '@components/Text';
import TextLink from '@components/TextLink';
import useLocalize from '@hooks/useLocalize';
import useThemeStyles from '@hooks/useThemeStyles';
import * as ReportActionUtils from '@libs/ReportActionsUtils';
import {getExportIntegrationActionFragments} from '@libs/ReportActionsUtils';
import type {ReportAction} from '@src/types/onyx';

type ExportIntegrationProps = {
Expand All @@ -14,7 +15,8 @@ type ExportIntegrationProps = {

function ExportIntegration({action}: ExportIntegrationProps) {
const styles = useThemeStyles();
const fragments = ReportActionUtils.getExportIntegrationActionFragments(action);
const {translate} = useLocalize();
const fragments = getExportIntegrationActionFragments(translate, action);

return (
<View style={[styles.flex1, styles.flexRow, styles.alignItemsCenter, styles.flexWrap]}>
Expand Down
46 changes: 28 additions & 18 deletions src/libs/OptionsListUtils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,14 @@
getIOUReportIDFromReportActionPreview,
getJoinRequestMessage,
getLastVisibleMessage,
getLeaveRoomMessage,
getMentionedAccountIDsFromAction,
getMessageOfOldDotReportAction,
getOneTransactionThreadReportID,
getOriginalMessage,
getReceiptScanFailedMessage,
getRenamedAction,
getReopenedMessage,
getReportActionActorAccountID,
getReportActionHtml,
getReportActionMessageText,
getRetractedMessage,
getRoomAvatarUpdatedMessage,
getRoomChangeLogMessage,
getSortedReportActions,
Expand Down Expand Up @@ -190,7 +186,7 @@
*/
let currentUserLogin: string | undefined;
let currentUserAccountID: number | undefined;
Onyx.connect({

Check warning on line 189 in src/libs/OptionsListUtils/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.SESSION,
callback: (value) => {
currentUserLogin = value?.email;
Expand All @@ -199,13 +195,13 @@
});

let allPersonalDetails: OnyxEntry<PersonalDetailsList>;
Onyx.connect({

Check warning on line 198 in src/libs/OptionsListUtils/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
callback: (value) => (allPersonalDetails = isEmptyObject(value) ? {} : value),
});

const policies: OnyxCollection<Policy> = {};
Onyx.connect({

Check warning on line 204 in src/libs/OptionsListUtils/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.POLICY,
callback: (policy, key) => {
if (!policy || !key || !policy.name) {
Expand All @@ -217,14 +213,14 @@
});

let allPolicies: OnyxCollection<Policy> = {};
Onyx.connect({

Check warning on line 216 in src/libs/OptionsListUtils/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.POLICY,
waitForCollectionCallback: true,
callback: (val) => (allPolicies = val),
});

let allReports: OnyxCollection<Report>;
Onyx.connect({

Check warning on line 223 in src/libs/OptionsListUtils/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -233,7 +229,7 @@
});

let allReportNameValuePairs: OnyxCollection<ReportNameValuePairs>;
Onyx.connect({

Check warning on line 232 in src/libs/OptionsListUtils/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -245,7 +241,7 @@
const allSortedReportActions: Record<string, ReportAction[]> = {};
let allReportActions: OnyxCollection<ReportActions>;
const lastVisibleReportActions: ReportActions = {};
Onyx.connect({

Check warning on line 244 in src/libs/OptionsListUtils/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT_ACTIONS,
waitForCollectionCallback: true,
callback: (actions) => {
Expand Down Expand Up @@ -307,7 +303,7 @@
});

let activePolicyID: OnyxEntry<string>;
Onyx.connect({

Check warning on line 306 in src/libs/OptionsListUtils/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.NVP_ACTIVE_POLICY_ID,
callback: (value) => (activePolicyID = value),
});
Expand Down Expand Up @@ -743,44 +739,58 @@
} else if (isActionableAddPaymentCard(lastReportAction)) {
lastMessageTextFromReport = getReportActionMessageText(lastReportAction);
} else if (lastReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.EXPORTED_TO_INTEGRATION) {
lastMessageTextFromReport = getExportIntegrationLastMessageText(lastReportAction);
// eslint-disable-next-line @typescript-eslint/no-deprecated
lastMessageTextFromReport = getExportIntegrationLastMessageText(translateLocal, lastReportAction);
} else if (lastReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.RECEIPT_SCAN_FAILED) {
lastMessageTextFromReport = getReceiptScanFailedMessage();
// eslint-disable-next-line @typescript-eslint/no-deprecated
lastMessageTextFromReport = translateLocal('iou.receiptScanningFailed');
} else if (lastReportAction?.actionName && isOldDotReportAction(lastReportAction)) {
lastMessageTextFromReport = getMessageOfOldDotReportAction(lastReportAction, false);
// eslint-disable-next-line @typescript-eslint/no-deprecated
lastMessageTextFromReport = getMessageOfOldDotReportAction(translateLocal, lastReportAction, false);
} else if (isActionableJoinRequest(lastReportAction)) {
lastMessageTextFromReport = getJoinRequestMessage(lastReportAction);
// eslint-disable-next-line @typescript-eslint/no-deprecated
lastMessageTextFromReport = getJoinRequestMessage(translateLocal, lastReportAction);
} else if (lastReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.ROOM_CHANGE_LOG.LEAVE_ROOM) {
lastMessageTextFromReport = getLeaveRoomMessage();
// eslint-disable-next-line @typescript-eslint/no-deprecated
lastMessageTextFromReport = translateLocal('report.actions.type.leftTheChat');
} else if (lastReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.RESOLVED_DUPLICATES) {
// eslint-disable-next-line @typescript-eslint/no-deprecated
lastMessageTextFromReport = translateLocal('violations.resolvedDuplicates');
} else if (isActionOfType(lastReportAction, CONST.REPORT.ACTIONS.TYPE.ROOM_CHANGE_LOG.UPDATE_ROOM_DESCRIPTION)) {
lastMessageTextFromReport = Parser.htmlToText(getUpdateRoomDescriptionMessage(lastReportAction));
// eslint-disable-next-line @typescript-eslint/no-deprecated
lastMessageTextFromReport = Parser.htmlToText(getUpdateRoomDescriptionMessage(translateLocal, lastReportAction));
} else if (isActionOfType(lastReportAction, CONST.REPORT.ACTIONS.TYPE.ROOM_CHANGE_LOG.UPDATE_ROOM_AVATAR)) {
lastMessageTextFromReport = getRoomAvatarUpdatedMessage(lastReportAction);
// eslint-disable-next-line @typescript-eslint/no-deprecated
lastMessageTextFromReport = getRoomAvatarUpdatedMessage(translateLocal, lastReportAction);
} else if (isActionOfType(lastReportAction, CONST.REPORT.ACTIONS.TYPE.RETRACTED)) {
lastMessageTextFromReport = getRetractedMessage();
// eslint-disable-next-line @typescript-eslint/no-deprecated
lastMessageTextFromReport = translateLocal('iou.retracted');
} else if (isActionOfType(lastReportAction, CONST.REPORT.ACTIONS.TYPE.REOPENED)) {
lastMessageTextFromReport = getReopenedMessage();
// eslint-disable-next-line @typescript-eslint/no-deprecated
lastMessageTextFromReport = translateLocal('iou.reopened');
} else if (isActionOfType(lastReportAction, CONST.REPORT.ACTIONS.TYPE.CHANGE_POLICY)) {
lastMessageTextFromReport = getPolicyChangeMessage(lastReportAction);
} else if (isActionOfType(lastReportAction, CONST.REPORT.ACTIONS.TYPE.TRAVEL_UPDATE)) {
lastMessageTextFromReport = getTravelUpdateMessage(lastReportAction);
// eslint-disable-next-line @typescript-eslint/no-deprecated
lastMessageTextFromReport = getTravelUpdateMessage(translateLocal, lastReportAction);
} else if (isInviteOrRemovedAction(lastReportAction)) {
lastMessageTextFromReport = getRoomChangeLogMessage(lastReportAction);
// eslint-disable-next-line @typescript-eslint/no-deprecated
lastMessageTextFromReport = getRoomChangeLogMessage(translateLocal, lastReportAction);
} else if (isRenamedAction(lastReportAction)) {
lastMessageTextFromReport = getRenamedAction(lastReportAction, isExpenseReport(report));
// eslint-disable-next-line @typescript-eslint/no-deprecated
lastMessageTextFromReport = getRenamedAction(translateLocal, lastReportAction, isExpenseReport(report));
} else if (isActionOfType(lastReportAction, CONST.REPORT.ACTIONS.TYPE.DELETED_TRANSACTION)) {
lastMessageTextFromReport = getDeletedTransactionMessage(lastReportAction);
} else if (isActionOfType(lastReportAction, CONST.REPORT.ACTIONS.TYPE.TAKE_CONTROL) || isActionOfType(lastReportAction, CONST.REPORT.ACTIONS.TYPE.REROUTE)) {
lastMessageTextFromReport = Parser.htmlToText(getChangedApproverActionMessage(lastReportAction));
// eslint-disable-next-line @typescript-eslint/no-deprecated
lastMessageTextFromReport = Parser.htmlToText(getChangedApproverActionMessage(translateLocal, lastReportAction));
} else if (isMovedAction(lastReportAction)) {
lastMessageTextFromReport = Parser.htmlToText(getMovedActionMessage(lastReportAction, report));
} else if (isActionOfType(lastReportAction, CONST.REPORT.ACTIONS.TYPE.UNREPORTED_TRANSACTION)) {
lastMessageTextFromReport = Parser.htmlToText(getUnreportedTransactionMessage(lastReportAction));
} else if (isActionableMentionWhisper(lastReportAction)) {
lastMessageTextFromReport = Parser.htmlToText(getActionableMentionWhisperMessage(lastReportAction));
// eslint-disable-next-line @typescript-eslint/no-deprecated
lastMessageTextFromReport = Parser.htmlToText(getActionableMentionWhisperMessage(translateLocal, lastReportAction));
} else if (isActionOfType(lastReportAction, CONST.REPORT.ACTIONS.TYPE.DYNAMIC_EXTERNAL_WORKFLOW_ROUTED)) {
// eslint-disable-next-line @typescript-eslint/no-deprecated
lastMessageTextFromReport = getDynamicExternalWorkflowRoutedMessage(lastReportAction, translateLocal);
Expand Down
Loading
Loading