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
4 changes: 0 additions & 4 deletions src/CONST/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6341,10 +6341,6 @@ const CONST = {
RBR_MESSAGE_MAX_CHARACTERS_FOR_PREVIEW: 40,
},

REPORT_VIOLATIONS_EXCLUDED_FIELDS: {
TEXT_TITLE: 'text_title',
},

/** Context menu types */
CONTEXT_MENU_TYPES: {
LINK: 'LINK',
Expand Down
2 changes: 0 additions & 2 deletions src/ONYXKEYS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,6 @@ const ONYXKEYS = {
REPORT_USER_IS_TYPING: 'reportUserIsTyping_',
PENDING_CONCIERGE_RESPONSE: 'pendingConciergeResponse_',
REPORT_USER_IS_LEAVING_ROOM: 'reportUserIsLeavingRoom_',
REPORT_VIOLATIONS: 'reportViolations_',
SECURITY_GROUP: 'securityGroup_',
TRANSACTION: 'transactions_',
TRANSACTION_VIOLATIONS: 'transactionViolations_',
Expand Down Expand Up @@ -1198,7 +1197,6 @@ type OnyxCollectionValuesMapping = {
[ONYXKEYS.COLLECTION.REPORT_USER_IS_TYPING]: OnyxTypes.ReportUserIsTyping;
[ONYXKEYS.COLLECTION.PENDING_CONCIERGE_RESPONSE]: OnyxTypes.PendingConciergeResponse;
[ONYXKEYS.COLLECTION.REPORT_USER_IS_LEAVING_ROOM]: boolean;
[ONYXKEYS.COLLECTION.REPORT_VIOLATIONS]: OnyxTypes.ReportViolations;
[ONYXKEYS.COLLECTION.SECURITY_GROUP]: OnyxTypes.SecurityGroup;
[ONYXKEYS.COLLECTION.TRANSACTION]: OnyxTypes.Transaction;
[ONYXKEYS.COLLECTION.TRANSACTION_DRAFT]: OnyxTypes.Transaction;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {View} from 'react-native';
import type {OnyxEntry} from 'react-native-onyx';
import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription';
import OfflineWithFeedback from '@components/OfflineWithFeedback';
import useOnyx from '@hooks/useOnyx';
import useThemeStyles from '@hooks/useThemeStyles';
import {clearReportFieldKeyErrors} from '@libs/actions/Report';
import {resolveReportFieldValue} from '@libs/Formula';
Expand All @@ -23,7 +22,6 @@ import {
} from '@libs/ReportUtils';
import type {ThemeStyles} from '@styles/index';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
import type {Policy, PolicyReportField, Report, ReportViolationName} from '@src/types/onyx';
import type {PendingAction} from '@src/types/onyx/OnyxCommon';
Expand Down Expand Up @@ -82,8 +80,6 @@ function ReportFieldView(reportField: EnrichedPolicyReportField, report: OnyxEnt
function MoneyRequestViewReportFields({report, policy, isCombinedReport = false, pendingAction}: MoneyRequestViewReportFieldsProps) {
const styles = useThemeStyles();

const [violations] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_VIOLATIONS}${report?.reportID}`);

const sortedPolicyReportFields = useMemo<EnrichedPolicyReportField[]>((): EnrichedPolicyReportField[] => {
const {fieldValues, fieldsByName} = getReportFieldMaps(report, policy?.fieldList ?? {});
const fields = Object.values(fieldsByName);
Expand All @@ -98,7 +94,7 @@ function MoneyRequestViewReportFields({report, policy, isCombinedReport = false,
const isDeletedFormulaField = field.type === CONST.REPORT_FIELD_TYPES.FORMULA && field.deletable;
const fieldKey = getReportFieldKey(field.fieldID);

const violation = isFieldDisabled ? undefined : getFieldViolation(violations, field);
const violation = isFieldDisabled ? undefined : getFieldViolation(field);
const violationTranslation = getFieldViolationTranslation(field, violation);

return {
Expand All @@ -110,7 +106,7 @@ function MoneyRequestViewReportFields({report, policy, isCombinedReport = false,
violationTranslation,
};
});
}, [policy, report, violations]);
}, [policy, report]);

const enabledReportFields = sortedPolicyReportFields.filter(
(reportField) => !isReportFieldDisabled(report, reportField, policy) || reportField.type === CONST.REPORT_FIELD_TYPES.FORMULA,
Expand Down
6 changes: 1 addition & 5 deletions src/components/ReportActionItem/MoneyReportView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import UnreadActionIndicator from '@components/UnreadActionIndicator';
import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset';
import useLocalize from '@hooks/useLocalize';
import useNetwork from '@hooks/useNetwork';
import useOnyx from '@hooks/useOnyx';
import useReportTransactions from '@hooks/useReportTransactions';
import useStyleUtils from '@hooks/useStyleUtils';
import useTheme from '@hooks/useTheme';
Expand Down Expand Up @@ -46,7 +45,6 @@ import variables from '@styles/variables';
import CONST from '@src/CONST';
import type {TranslationPaths} from '@src/languages/types';
import {clearReportFieldKeyErrors} from '@src/libs/actions/Report';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
import type {Policy, Report} from '@src/types/onyx';
import type {PendingAction} from '@src/types/onyx/OnyxCommon';
Expand Down Expand Up @@ -115,8 +113,6 @@ function MoneyReportView({
StyleUtils.getColorStyle(theme.textSupporting),
];

const [violations] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_VIOLATIONS}${report?.reportID}`);

const {sortedPolicyReportFields, fieldValues, fieldsByName} = useMemo(() => {
const {fieldValues: values, fieldsByName: byName} = getReportFieldMaps(report, policy?.fieldList ?? {});
const sorted = Object.values(byName)
Expand Down Expand Up @@ -176,7 +172,7 @@ function MoneyReportView({
const isFieldDisabled = isReportFieldDisabledForUser(report, reportField, policy);
const fieldKey = getReportFieldKey(reportField.fieldID);

const violation = isFieldDisabled ? undefined : getFieldViolation(violations, reportField);
const violation = isFieldDisabled ? undefined : getFieldViolation(reportField);
const violationTranslation = getFieldViolationTranslation(reportField, violation);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ function TransactionPreviewContent({
const styles = useThemeStyles();
const {translate} = useLocalize();
const {environmentURL} = useEnvironment();
const [reportViolations] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_VIOLATIONS}${getNonEmptyStringOnyxID(report?.reportID)}`);
const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID}`);
const isParentPolicyExpenseChat = isPolicyExpenseChat(chatReport);
const transactionDetails = useMemo<Partial<TransactionDetails>>(
Expand Down Expand Up @@ -115,9 +114,8 @@ function TransactionPreviewContent({
currentUserEmail,
currentUserAccountID,
reportActions,
reportViolations,
}),
[areThereDuplicates, transactionPreviewCommonArguments, isReportAPolicyExpenseChat, currentUserEmail, currentUserAccountID, reportActions, reportViolations],
[areThereDuplicates, transactionPreviewCommonArguments, isReportAPolicyExpenseChat, currentUserEmail, currentUserAccountID, reportActions],
);

const {shouldShowRBR, shouldShowMerchant, shouldShowSplitShare, shouldShowTag, shouldShowCategory, shouldShowSkeleton, shouldShowDescription} = conditionals;
Expand Down
24 changes: 2 additions & 22 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
ReportMetadata,
ReportNameValuePairs,
ReportViolationName,
ReportViolations,
Task,
Transaction,
TransactionViolation,
Expand Down Expand Up @@ -1051,7 +1050,7 @@
};

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

Check warning on line 1053 in src/libs/ReportUtils.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.CONCIERGE_REPORT_ID,
callback: (value) => {
conciergeReportIDOnyxConnect = value;
Expand All @@ -1059,7 +1058,7 @@
});

const defaultAvatarBuildingIconTestID = 'SvgDefaultAvatarBuilding Icon';
Onyx.connect({

Check warning on line 1061 in src/libs/ReportUtils.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) => {
// When signed out, val is undefined
Expand All @@ -1077,7 +1076,7 @@
let allPersonalDetails: OnyxEntry<PersonalDetailsList>;
let allPersonalDetailLogins: string[];
let currentUserPersonalDetails: OnyxEntry<PersonalDetails>;
Onyx.connect({

Check warning on line 1079 in src/libs/ReportUtils.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) => {
if (currentUserAccountID) {
Expand All @@ -1089,7 +1088,7 @@
});

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

Check warning on line 1091 in src/libs/ReportUtils.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_DRAFT,
waitForCollectionCallback: true,
callback: (value) => (allReportsDraft = value),
Expand All @@ -1097,7 +1096,7 @@

let allPolicies: OnyxCollection<Policy>;
let policiesArray: Policy[] = [];
Onyx.connect({

Check warning on line 1099 in src/libs/ReportUtils.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: (value) => {
Expand All @@ -1107,7 +1106,7 @@
});

let allPolicyDrafts: OnyxCollection<Policy>;
Onyx.connect({

Check warning on line 1109 in src/libs/ReportUtils.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_DRAFTS,
waitForCollectionCallback: true,
callback: (value) => (allPolicyDrafts = value),
Expand All @@ -1115,7 +1114,7 @@

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

Check warning on line 1117 in src/libs/ReportUtils.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 Down Expand Up @@ -1151,14 +1150,14 @@
});

let betaConfiguration: OnyxEntry<BetaConfiguration> = {};
Onyx.connect({

Check warning on line 1153 in src/libs/ReportUtils.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.BETA_CONFIGURATION,
callback: (value) => (betaConfiguration = value ?? {}),
});

let deprecatedAllTransactions: OnyxCollection<Transaction> = {};
let deprecatedReportsTransactions: Record<string, Transaction[]> = {};
Onyx.connect({

Check warning on line 1160 in src/libs/ReportUtils.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.TRANSACTION,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -1184,7 +1183,7 @@
});

let allReportActions: OnyxCollection<ReportActions>;
Onyx.connect({

Check warning on line 1186 in src/libs/ReportUtils.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 @@ -9282,13 +9281,6 @@
);
}

function hasReportViolations(reportViolations: OnyxEntry<ReportViolations>) {
if (!reportViolations) {
return false;
}
return Object.values(reportViolations ?? {}).some((violations) => !isEmptyObject(violations));
}

/**
* Checks if submission should be blocked due to strict policy rules being enabled and violations present.
* When a user's domain has "strictly enforce workspace rules" enabled, they cannot submit reports with violations.
Expand Down Expand Up @@ -12378,23 +12370,12 @@
/**
* Checks if given field has any violations and returns name of the first encountered one
*/
function getFieldViolation(violations: OnyxEntry<ReportViolations>, reportField: PolicyReportField): ReportViolationName | undefined {
function getFieldViolation(reportField: PolicyReportField): ReportViolationName | undefined {
if (!reportField) {
return undefined;
}

if (!violations) {
return (reportField.value ?? reportField.defaultValue) ? undefined : CONST.REPORT_VIOLATIONS.FIELD_REQUIRED;
}

const fieldViolation = Object.values(CONST.REPORT_VIOLATIONS).find((violation) => !!violations[violation] && violations[violation][reportField.fieldID]);

// If the field has no value or no violation, we return 'fieldRequired' violation
if (!fieldViolation) {
return reportField.value ? undefined : CONST.REPORT_VIOLATIONS.FIELD_REQUIRED;
}

return fieldViolation;
return (reportField.value ?? reportField.defaultValue) ? undefined : CONST.REPORT_VIOLATIONS.FIELD_REQUIRED;
}

/**
Expand Down Expand Up @@ -13481,7 +13462,6 @@
getMostRecentlyVisitedReport,
getSourceIDFromReportAction,
getIntegrationNameFromExportMessage,
hasReportViolations,
isPayAtEndExpenseReport,
getApprovalChain,
isIndividualInvoiceRoom,
Expand Down
16 changes: 2 additions & 14 deletions src/libs/TransactionPreviewUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,7 @@ import {convertToDisplayString} from './CurrencyUtils';
import DateUtils from './DateUtils';
import {hasDynamicExternalWorkflow} from './PolicyUtils';
import {getMostRecentActiveDEWSubmitFailedAction, getOriginalMessage, isDynamicExternalWorkflowSubmitFailedAction, isMessageDeleted, isMoneyRequestAction} from './ReportActionsUtils';
import {
hasActionWithErrorsForTransaction,
hasReceiptError,
hasReportViolations,
isPaidGroupPolicyExpenseReport,
isPaidGroupPolicy as isPaidGroupPolicyUtil,
isReportApproved,
isReportOwner,
isSettled,
} from './ReportUtils';
import {hasActionWithErrorsForTransaction, hasReceiptError, isPaidGroupPolicyExpenseReport, isPaidGroupPolicy as isPaidGroupPolicyUtil, isReportApproved, isSettled} from './ReportUtils';
import type {TransactionDetails} from './ReportUtils';
import StringUtils from './StringUtils';
import {
Expand Down Expand Up @@ -368,7 +359,6 @@ function getTransactionPreviewTextAndTranslationPaths({
}

function createTransactionPreviewConditionals({
reportViolations,
iouReport,
policy,
transaction,
Expand All @@ -382,7 +372,6 @@ function createTransactionPreviewConditionals({
currentUserAccountID,
reportActions,
}: {
reportViolations: OnyxEntry<OnyxTypes.ReportViolations>;
iouReport: OnyxEntry<OnyxTypes.Report>;
policy: OnyxEntry<OnyxTypes.Policy>;
transaction: OnyxEntry<OnyxTypes.Transaction> | undefined;
Expand Down Expand Up @@ -433,8 +422,7 @@ function createTransactionPreviewConditionals({
(violation) => violation.name === CONST.VIOLATIONS.MODIFIED_AMOUNT && (violation.type === CONST.VIOLATION_TYPES.VIOLATION || violation.type === CONST.VIOLATION_TYPES.NOTICE),
));
const hasErrorOrOnHold = hasFieldErrors || (!isFullySettled && !isFullyApproved && isTransactionOnHold);
const hasReportViolationsOrActionErrors =
(isReportOwner(iouReport) && hasReportViolations(reportViolations)) || hasActionWithErrorsForTransaction(iouReport?.reportID, transaction, reportActions);
const hasReportViolationsOrActionErrors = hasActionWithErrorsForTransaction(iouReport?.reportID, transaction, reportActions);
const isDEWSubmitFailed = hasDynamicExternalWorkflow(policy) && !!getMostRecentActiveDEWSubmitFailedAction(reportActions);
const shouldShowRBR = hasAnyViolations || hasErrorOrOnHold || hasReportViolationsOrActionErrors || hasReceiptError(transaction) || isDEWSubmitFailed;

Expand Down
76 changes: 2 additions & 74 deletions src/libs/actions/IOU/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ import {
getSubmitToAccountID,
hasDependentTags,
hasDynamicExternalWorkflow,
isControlPolicy,
isDelayedSubmissionEnabled,
isPaidGroupPolicy,
isPolicyAdmin,
Expand Down Expand Up @@ -1781,39 +1780,6 @@ function getReceiptError(
);
}

/** Helper function to get optimistic fields violations onyx data */
function getFieldViolationsOnyxData(iouReport: OnyxTypes.Report): OnyxData<typeof ONYXKEYS.COLLECTION.REPORT_VIOLATIONS> {
const missingFields: OnyxTypes.ReportFieldsViolations = {};
const excludedFields = Object.values(CONST.REPORT_VIOLATIONS_EXCLUDED_FIELDS) as string[];

for (const field of Object.values(iouReport.fieldList ?? {})) {
if (excludedFields.includes(field.fieldID) || !!field.value || !!field.defaultValue) {
continue;
}
// in case of missing field violation the empty object is indicator.
missingFields[field.fieldID] = {};
}

return {
optimisticData: [
{
onyxMethod: Onyx.METHOD.SET,
key: `${ONYXKEYS.COLLECTION.REPORT_VIOLATIONS}${iouReport.reportID}`,
value: {
fieldRequired: missingFields,
},
},
],
failureData: [
{
onyxMethod: Onyx.METHOD.SET,
key: `${ONYXKEYS.COLLECTION.REPORT_VIOLATIONS}${iouReport.reportID}`,
value: null,
},
],
};
}

type BuildOnyxDataForTestDriveIOUParams = {
transaction: OnyxTypes.Transaction;
iouOptimisticParams: MoneyRequestOptimisticParams['iou'];
Expand Down Expand Up @@ -2584,7 +2550,6 @@ type BuildOnyxDataForTrackExpenseParams = {
chat: {report: OnyxInputValue<OnyxTypes.Report>; previewAction: OnyxInputValue<ReportAction>};
iou: {report: OnyxInputValue<OnyxTypes.Report>; createdAction: OptimisticCreatedReportAction; action: OptimisticIOUReportAction};
transactionParams: {transaction: OnyxTypes.Transaction; threadReport: OptimisticChatReport | null; threadCreatedReportAction: OptimisticCreatedReportAction | null};
policyParams: {policy?: OnyxInputValue<OnyxTypes.Policy>; tagList?: OnyxInputValue<OnyxTypes.PolicyTagLists>; categories?: OnyxInputValue<OnyxTypes.PolicyCategories>};
shouldCreateNewMoneyRequestReport: boolean;
existingTransactionThreadReportID?: string;
actionableTrackExpenseWhisper?: OnyxInputValue<OnyxTypes.ReportAction>;
Expand All @@ -2601,15 +2566,13 @@ type BuildOnyxDataForTrackExpenseKeys =
| typeof ONYXKEYS.COLLECTION.TRANSACTION
| typeof ONYXKEYS.NVP_QUICK_ACTION_GLOBAL_CREATE
| typeof ONYXKEYS.COLLECTION.SNAPSHOT
| typeof ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS
| typeof ONYXKEYS.COLLECTION.REPORT_VIOLATIONS;
| typeof ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS;

/** Builds the Onyx data for track expense */
function buildOnyxDataForTrackExpense({
chat,
iou,
transactionParams,
policyParams = {},
shouldCreateNewMoneyRequestReport,
existingTransactionThreadReportID,
actionableTrackExpenseWhisper,
Expand All @@ -2621,8 +2584,6 @@ function buildOnyxDataForTrackExpense({
const {report: chatReport, previewAction: reportPreviewAction} = chat;
const {report: iouReport, createdAction: iouCreatedAction, action: iouAction} = iou;
const {transaction, threadReport: transactionThreadReport, threadCreatedReportAction: transactionThreadCreatedReportAction} = transactionParams;
const {policy, tagList: policyTagList, categories: policyCategories} = policyParams;

const isScanRequest = isScanRequestTransactionUtils(transaction);
const isDistanceRequest = isDistanceRequestTransactionUtils(transaction);
const clearedPendingFields = Object.fromEntries(Object.keys(transaction.pendingFields ?? {}).map((key) => [key, null]));
Expand Down Expand Up @@ -2998,38 +2959,6 @@ function buildOnyxDataForTrackExpense({
onyxData.successData?.push(...searchUpdate.successData);
}
}

// We don't need to compute violations unless we're on a paid policy
if (!policy || !isPaidGroupPolicy(policy) || transaction.reportID === CONST.REPORT.UNREPORTED_REPORT_ID) {
return onyxData;
}

const violationsOnyxData = ViolationsUtils.getViolationsOnyxData(
transaction,
[],
policy,
policyTagList ?? {},
policyCategories ?? {},
hasDependentTags(policy, policyTagList ?? {}),
false,
);

if (violationsOnyxData) {
onyxData.optimisticData?.push(violationsOnyxData);
onyxData.failureData?.push({
onyxMethod: Onyx.METHOD.SET,
key: `${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${transaction.transactionID}`,
value: [],
});
}

// Show field violations only for control policies
if (isControlPolicy(policy) && iouReport) {
const {optimisticData: fieldViolationsOptimisticData, failureData: fieldViolationsFailureData} = getFieldViolationsOnyxData(iouReport);
onyxData.optimisticData?.push(...(fieldViolationsOptimisticData ?? []));
onyxData.failureData?.push(...(fieldViolationsFailureData ?? []));
}

Comment on lines -3026 to -3032
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hungvu193 It is only safe to remove this if the condition in line 3095 is always true

if (!policy || !isPaidGroupPolicy(policy) || transaction.reportID === CONST.REPORT.UNREPORTED_REPORT_ID) {

So violationsOnyxData also should be removed if we removed this

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please help to confirm this one before removing

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This condition:

transaction.reportID === CONST.REPORT.UNREPORTED_REPORT_ID

is always true for track expense so it's safe to remove it. I'll remove the rest condition as well

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hungvu193 Please ping me when it's done. Thanks

return onyxData;
}

Expand Down Expand Up @@ -3722,7 +3651,7 @@ function getTrackExpenseInformation(params: GetTrackExpenseInformationParams): T
isSelfTourViewed,
} = params;
const {payeeAccountID = userAccountID, payeeEmail = currentUserEmail, participant} = participantParams;
const {policy, policyCategories, policyTagList} = policyParams;
const {policy} = policyParams;
const {
comment,
amount,
Expand Down Expand Up @@ -4017,7 +3946,6 @@ function getTrackExpenseInformation(params: GetTrackExpenseInformationParams): T
threadCreatedReportAction: optimisticCreatedActionForTransactionThread,
threadReport: optimisticTransactionThread ?? {},
},
policyParams: {policy, tagList: policyTagList, categories: policyCategories},
shouldCreateNewMoneyRequestReport,
actionableTrackExpenseWhisper,
retryParams,
Expand Down
Loading
Loading