Skip to content

Commit 4566c80

Browse files
mountinyOSBotify
authored andcommitted
Merge pull request #79020 from Expensify/jsenyitko-revert-6020367
[NO QA] Revert #78315 (cherry picked from commit e94e280) (cherry-picked to staging by mountiny)
1 parent 6829bc5 commit 4566c80

File tree

36 files changed

+81
-741
lines changed

36 files changed

+81
-741
lines changed

src/CONST/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5768,7 +5768,6 @@ const CONST = {
57685768
RECEIPT_GENERATED_WITH_AI: 'receiptGeneratedWithAI',
57695769
OVER_TRIP_LIMIT: 'overTripLimit',
57705770
COMPANY_CARD_REQUIRED: 'companyCardRequired',
5771-
MISSING_ATTENDEES: 'missingAttendees',
57725771
},
57735772
RTER_VIOLATION_TYPES: {
57745773
BROKEN_CARD_CONNECTION: 'brokenCardConnection',

src/ROUTES.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1967,10 +1967,6 @@ const ROUTES = {
19671967
route: 'workspaces/:policyID/category/:categoryName/require-receipts-over',
19681968
getRoute: (policyID: string, categoryName: string) => `workspaces/${policyID}/category/${encodeURIComponent(categoryName)}/require-receipts-over` as const,
19691969
},
1970-
WORKSPACE_CATEGORY_REQUIRED_FIELDS: {
1971-
route: 'workspaces/:policyID/category/:categoryName/required-fields',
1972-
getRoute: (policyID: string, categoryName: string) => `workspaces/${policyID}/category/${encodeURIComponent(categoryName)}/required-fields` as const,
1973-
},
19741970
WORKSPACE_CATEGORY_APPROVER: {
19751971
route: 'workspaces/:policyID/category/:categoryName/approver',
19761972
getRoute: (policyID: string, categoryName: string) => `workspaces/${policyID}/category/${encodeURIComponent(categoryName)}/approver` as const,

src/SCREENS.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,6 @@ const SCREENS = {
687687
CATEGORY_DESCRIPTION_HINT: 'Category_Description_Hint',
688688
CATEGORY_APPROVER: 'Category_Approver',
689689
CATEGORY_REQUIRE_RECEIPTS_OVER: 'Category_Require_Receipts_Over',
690-
CATEGORY_REQUIRED_FIELDS: 'Category_Required_Fields',
691690
CATEGORIES_SETTINGS: 'Categories_Settings',
692691
CATEGORIES_IMPORT: 'Categories_Import',
693692
CATEGORIES_IMPORTED: 'Categories_Imported',

src/components/MoneyRequestConfirmationList.tsx

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import {
3030
setMoneyRequestTaxRate,
3131
setSplitShares,
3232
} from '@libs/actions/IOU';
33-
import {getIsMissingAttendeesViolation} from '@libs/AttendeeUtils';
3433
import {isCategoryDescriptionRequired} from '@libs/CategoryUtils';
3534
import {convertToBackendAmount, convertToDisplayString, convertToDisplayStringWithoutCurrency, getCurrencyDecimals} from '@libs/CurrencyUtils';
3635
import DistanceRequestUtils from '@libs/DistanceRequestUtils';
@@ -921,12 +920,6 @@ function MoneyRequestConfirmationList({
921920
return;
922921
}
923922

924-
const isMissingAttendeesViolation = getIsMissingAttendeesViolation(policyCategories, iouCategory, iouAttendees, currentUserPersonalDetails, policy?.isAttendeeTrackingEnabled);
925-
if (isMissingAttendeesViolation) {
926-
setFormError('violations.missingAttendees');
927-
return;
928-
}
929-
930923
if (isPerDiemRequest && (transaction.comment?.customUnit?.subRates ?? []).length === 0) {
931924
setFormError('iou.error.invalidSubrateLength');
932925
return;
@@ -1000,8 +993,6 @@ function MoneyRequestConfirmationList({
1000993
showDelegateNoAccessModal,
1001994
iouCategory,
1002995
policyCategories,
1003-
iouAttendees,
1004-
currentUserPersonalDetails,
1005996
],
1006997
);
1007998

@@ -1025,10 +1016,6 @@ function MoneyRequestConfirmationList({
10251016
if (isTypeSplit && !shouldShowReadOnlySplits) {
10261017
return debouncedFormError && translate(debouncedFormError);
10271018
}
1028-
// Don't show error at the bottom of the form for missing attendees
1029-
if (formError === 'violations.missingAttendees') {
1030-
return;
1031-
}
10321019
return formError && translate(formError);
10331020
}, [routeError, isTypeSplit, shouldShowReadOnlySplits, debouncedFormError, formError, translate]);
10341021

src/components/MoneyRequestConfirmationListFooter.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,6 @@ function MoneyRequestConfirmationListFooter({
380380
const shouldDisplayDistanceRateError = formError === 'iou.error.invalidRate';
381381
const shouldDisplayTagError = formError === 'violations.tagOutOfPolicy';
382382
const shouldDisplayCategoryError = formError === 'violations.categoryOutOfPolicy';
383-
const shouldDisplayAttendeesError = formError === 'violations.missingAttendees';
384383

385384
const showReceiptEmptyState = shouldShowReceiptEmptyState(iouType, action, policy, isPerDiemRequest);
386385
// The per diem custom unit
@@ -728,7 +727,7 @@ function MoneyRequestConfirmationListFooter({
728727
item: (
729728
<MenuItemWithTopDescription
730729
key="attendees"
731-
shouldShowRightIcon={!isReadOnly}
730+
shouldShowRightIcon
732731
title={iouAttendees?.map((item) => item?.displayName ?? item?.login).join(', ')}
733732
description={`${translate('iou.attendees')} ${
734733
iouAttendees?.length && iouAttendees.length > 1 && formattedAmountPerAttendee ? `\u00B7 ${formattedAmountPerAttendee} ${translate('common.perPerson')}` : ''
@@ -742,10 +741,8 @@ function MoneyRequestConfirmationListFooter({
742741

743742
Navigation.navigate(ROUTES.MONEY_REQUEST_ATTENDEE.getRoute(action, iouType, transactionID, reportID, Navigation.getActiveRoute()));
744743
}}
745-
interactive={!isReadOnly}
744+
interactive
746745
shouldRenderAsHTML
747-
brickRoadIndicator={shouldDisplayAttendeesError ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined}
748-
errorText={shouldDisplayAttendeesError ? translate(formError) : ''}
749746
/>
750747
),
751748
shouldShow: shouldShowAttendees,

src/components/ReportActionItem/MoneyRequestView.tsx

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ import useThemeStyles from '@hooks/useThemeStyles';
3232
import useTransactionViolations from '@hooks/useTransactionViolations';
3333
import type {ViolationField} from '@hooks/useViolations';
3434
import useViolations from '@hooks/useViolations';
35-
import {initSplitExpense, updateMoneyRequestBillable, updateMoneyRequestReimbursable} from '@libs/actions/IOU/index';
36-
import {getIsMissingAttendeesViolation} from '@libs/AttendeeUtils';
3735
import {filterPersonalCards, getCompanyCardDescription} from '@libs/CardUtils';
3836
import {getDecodedCategoryName, isCategoryMissing} from '@libs/CategoryUtils';
3937
import {convertToDisplayString} from '@libs/CurrencyUtils';
@@ -53,12 +51,13 @@ import {
5351
isTaxTrackingEnabled,
5452
} from '@libs/PolicyUtils';
5553
import {getOriginalMessage, isMoneyRequestAction} from '@libs/ReportActionsUtils';
56-
import {computeReportName} from '@libs/ReportNameUtils';
5754
import {isSplitAction} from '@libs/ReportSecondaryActionUtils';
5855
import {
5956
canEditFieldOfMoneyRequest,
6057
canEditMoneyRequest,
6158
canUserPerformWriteAction as canUserPerformWriteActionReportUtils,
59+
// eslint-disable-next-line @typescript-eslint/no-deprecated
60+
getReportName,
6261
getTransactionDetails,
6362
getTripIDFromTransactionParentReportID,
6463
isExpenseReport,
@@ -98,6 +97,7 @@ import {
9897
import ViolationsUtils from '@libs/Violations/ViolationsUtils';
9998
import Navigation from '@navigation/Navigation';
10099
import AnimatedEmptyStateBackground from '@pages/home/report/AnimatedEmptyStateBackground';
100+
import {initSplitExpense, updateMoneyRequestBillable, updateMoneyRequestReimbursable} from '@userActions/IOU';
101101
import CONST from '@src/CONST';
102102
import type {TranslationPaths} from '@src/languages/types';
103103
import ONYXKEYS from '@src/ONYXKEYS';
@@ -167,7 +167,6 @@ function MoneyRequestView({
167167
const {getReportRHPActiveRoute} = useActiveRoute();
168168
const [lastVisitedPath] = useOnyx(ONYXKEYS.LAST_VISITED_PATH, {canBeMissing: true});
169169

170-
const [allPolicies] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {canBeMissing: true});
171170
const [allTransactions] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION, {canBeMissing: false});
172171

173172
const searchContext = useSearchContext();
@@ -473,13 +472,6 @@ function MoneyRequestView({
473472
const hasErrors = hasMissingSmartscanFields(transaction);
474473
// Need to return undefined when we have pendingAction to avoid the duplicate pending action
475474
const getPendingFieldAction = (fieldPath: TransactionPendingFieldsKey) => (pendingAction ? undefined : transaction?.pendingFields?.[fieldPath]);
476-
const isMissingAttendeesViolation = getIsMissingAttendeesViolation(
477-
policyCategories,
478-
updatedTransaction?.category ?? categoryForDisplay,
479-
actualAttendees,
480-
currentUserPersonalDetails,
481-
policy?.isAttendeeTrackingEnabled,
482-
);
483475

484476
const getErrorForField = (field: ViolationField, data?: OnyxTypes.TransactionViolation['data'], policyHasDependentTags = false, tagValue?: string) => {
485477
// Checks applied when creating a new expense
@@ -520,10 +512,6 @@ function MoneyRequestView({
520512
return `${violations.map((violation) => ViolationsUtils.getViolationTranslation(violation, translate, canEdit, undefined, companyCardPageURL)).join('. ')}.`;
521513
}
522514

523-
if (field === 'attendees' && isMissingAttendeesViolation) {
524-
return translate('violations.missingAttendees');
525-
}
526-
527515
return '';
528516
};
529517

@@ -732,9 +720,8 @@ function MoneyRequestView({
732720
);
733721
});
734722

735-
const reportNameToDisplay = isFromMergeTransaction
736-
? (updatedTransaction?.reportName ?? translate('common.none'))
737-
: (parentReport?.reportName ?? computeReportName(parentReport, allReports, allPolicies, allTransactions));
723+
// eslint-disable-next-line @typescript-eslint/no-deprecated
724+
const reportNameToDisplay = isFromMergeTransaction ? (updatedTransaction?.reportName ?? translate('common.none')) : (parentReport?.reportName ?? getReportName(parentReport));
738725
const shouldShowReport = !!parentReportID || (isFromMergeTransaction && !!reportNameToDisplay);
739726
const reportCopyValue = !canEditReport && reportNameToDisplay !== translate('common.none') ? reportNameToDisplay : undefined;
740727
const shouldShowCategoryAnalyzing = isCategoryBeingAnalyzed(updatedTransaction ?? transaction);
@@ -1025,8 +1012,6 @@ function MoneyRequestView({
10251012
onPress={() => {
10261013
Navigation.navigate(ROUTES.MONEY_REQUEST_ATTENDEE.getRoute(CONST.IOU.ACTION.EDIT, iouType, transaction.transactionID, transactionThreadReport?.reportID));
10271014
}}
1028-
brickRoadIndicator={getErrorForField('attendees') ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined}
1029-
errorText={getErrorForField('attendees')}
10301015
interactive={canEdit}
10311016
shouldShowRightIcon={canEdit}
10321017
shouldRenderAsHTML

src/components/SelectionListWithSections/Search/TransactionListItem.tsx

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import useTheme from '@hooks/useTheme';
2121
import useThemeStyles from '@hooks/useThemeStyles';
2222
import type {TransactionPreviewData} from '@libs/actions/Search';
2323
import {handleActionButtonPress as handleActionButtonPressUtil} from '@libs/actions/Search';
24-
import {syncMissingAttendeesViolation} from '@libs/AttendeeUtils';
2524
import getNonEmptyStringOnyxID from '@libs/getNonEmptyStringOnyxID';
2625
import {isViolationDismissed, shouldShowViolation} from '@libs/TransactionUtils';
2726
import variables from '@styles/variables';
@@ -66,8 +65,6 @@ function TransactionListItem<TItem extends ListItem>({
6665
const snapshotPolicy = useMemo(() => {
6766
return (snapshot?.data?.[`${ONYXKEYS.COLLECTION.POLICY}${transactionItem.policyID}`] ?? {}) as Policy;
6867
}, [snapshot, transactionItem.policyID]);
69-
// Fetch policy categories directly from Onyx since they are not included in the search snapshot
70-
const [policyCategories] = originalUseOnyx(`${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${transactionItem.policyID}`, {canBeMissing: true});
7168
const [lastPaymentMethod] = useOnyx(`${ONYXKEYS.NVP_LAST_PAYMENT_METHOD}`, {canBeMissing: true});
7269
const [personalPolicyID] = useOnyx(ONYXKEYS.PERSONAL_POLICY_ID, {canBeMissing: true});
7370

@@ -124,25 +121,12 @@ function TransactionListItem<TItem extends ListItem>({
124121
]);
125122

126123
const transactionViolations = useMemo(() => {
127-
const onyxViolations = (violations?.[`${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${transactionItem.transactionID}`] ?? []).filter(
124+
return (violations?.[`${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${transactionItem.transactionID}`] ?? []).filter(
128125
(violation: TransactionViolation) =>
129126
!isViolationDismissed(transactionItem, violation, currentUserDetails.email ?? '', currentUserDetails.accountID, snapshotReport, snapshotPolicy) &&
130127
shouldShowViolation(snapshotReport, snapshotPolicy, violation.name, currentUserDetails.email ?? '', false, transactionItem),
131128
);
132-
133-
// Sync missingAttendees violation with current policy category settings (can be removed later when BE handles this)
134-
const attendeeOnyxViolations = syncMissingAttendeesViolation(
135-
onyxViolations,
136-
policyCategories,
137-
transactionItem.category ?? '',
138-
transactionItem.attendees,
139-
currentUserDetails,
140-
snapshotPolicy?.isAttendeeTrackingEnabled ?? false,
141-
snapshotPolicy?.type === CONST.POLICY.TYPE.CORPORATE,
142-
);
143-
144-
return [...onyxViolations, ...attendeeOnyxViolations];
145-
}, [snapshotPolicy, policyCategories, snapshotReport, transactionItem, violations, currentUserDetails.email, currentUserDetails.accountID, currentUserDetails]);
129+
}, [snapshotPolicy, snapshotReport, transactionItem, violations, currentUserDetails.email, currentUserDetails.accountID]);
146130

147131
const {isDelegateAccessRestricted, showDelegateNoAccessModal} = useContext(DelegateNoAccessContext);
148132

src/hooks/useViolations.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import type {TransactionViolation, ViolationName} from '@src/types/onyx';
66
/**
77
* Names of Fields where violations can occur.
88
*/
9-
const validationFields = ['amount', 'billable', 'category', 'comment', 'date', 'merchant', 'receipt', 'tag', 'tax', 'attendees', 'customUnitRateID', 'none'] as const;
9+
const validationFields = ['amount', 'billable', 'category', 'comment', 'date', 'merchant', 'receipt', 'tag', 'tax', 'customUnitRateID', 'none'] as const;
1010

1111
type ViolationField = TupleToUnion<typeof validationFields>;
1212

@@ -28,7 +28,6 @@ const violationNameToField: Record<ViolationName, (violation: TransactionViolati
2828
maxAge: () => 'date',
2929
missingCategory: () => 'category',
3030
missingComment: () => 'comment',
31-
missingAttendees: () => 'attendees',
3231
missingTag: () => 'tag',
3332
modifiedAmount: () => 'amount',
3433
modifiedDate: () => 'date',

src/languages/de.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6219,10 +6219,6 @@ Fordere Spesendetails wie Belege und Beschreibungen an, lege Limits und Standard
62196219
title: 'Kategorierichtlinien',
62206220
approver: 'Genehmiger',
62216221
requireDescription: 'Beschreibung erforderlich',
6222-
requireFields: 'Felder verpflichtend machen',
6223-
requiredFieldsTitle: 'Pflichtfelder',
6224-
requiredFieldsDescription: (categoryName: string) => `Dies gilt für alle Ausgaben, die als <strong>${categoryName}</strong> kategorisiert sind.`,
6225-
requireAttendees: 'Teilnehmer erforderlich machen',
62266222
descriptionHint: 'Hinweis zur Beschreibung',
62276223
descriptionHintDescription: (categoryName: string) =>
62286224
`Mitarbeitende daran erinnern, zusätzliche Informationen für Ausgaben der Kategorie „${categoryName}“ anzugeben. Dieser Hinweis erscheint im Beschreibungsfeld von Ausgaben.`,
@@ -7275,7 +7271,6 @@ Fordere Spesendetails wie Belege und Beschreibungen an, lege Limits und Standard
72757271
maxAge: ({maxAge}: ViolationsMaxAgeParams) => `Datum älter als ${maxAge} Tage`,
72767272
missingCategory: 'Fehlende Kategorie',
72777273
missingComment: 'Beschreibung für ausgewählte Kategorie erforderlich',
7278-
missingAttendees: 'Für diese Kategorie sind mehrere Teilnehmer erforderlich',
72797274
missingTag: ({tagName}: ViolationsMissingTagParams = {}) => `Fehlende ${tagName ?? 'Tag'}`,
72807275
modifiedAmount: ({type, displayPercentVariance}: ViolationsModifiedAmountParams) => {
72817276
switch (type) {

src/languages/en.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6079,10 +6079,6 @@ const translations = {
60796079
title: 'Category rules',
60806080
approver: 'Approver',
60816081
requireDescription: 'Require description',
6082-
requireFields: 'Require fields',
6083-
requiredFieldsTitle: 'Required fields',
6084-
requiredFieldsDescription: (categoryName: string) => `This will apply to all expenses categorized as <strong>${categoryName}</strong>.`,
6085-
requireAttendees: 'Require attendees',
60866082
descriptionHint: 'Description hint',
60876083
descriptionHintDescription: (categoryName: string) =>
60886084
`Remind employees to provide additional information for “${categoryName}” spend. This hint appears in the description field on expenses.`,
@@ -7167,7 +7163,6 @@ const translations = {
71677163
maxAge: ({maxAge}: ViolationsMaxAgeParams) => `Date older than ${maxAge} days`,
71687164
missingCategory: 'Missing category',
71697165
missingComment: 'Description required for selected category',
7170-
missingAttendees: 'Multiple attendees required for this category',
71717166
missingTag: ({tagName}: ViolationsMissingTagParams = {}) => `Missing ${tagName ?? 'tag'}`,
71727167
modifiedAmount: ({type, displayPercentVariance}: ViolationsModifiedAmountParams) => {
71737168
switch (type) {

0 commit comments

Comments
 (0)