Skip to content

Commit d56c882

Browse files
committed
Revert "Merge pull request #59672 from Expensify/jsenyitko-task-context"
This reverts commit b249592, reversing changes made to c48fd3e.
1 parent d391099 commit d56c882

39 files changed

+404
-1571
lines changed

src/CONST.ts

-16
Original file line numberDiff line numberDiff line change
@@ -6437,7 +6437,6 @@ const CONST = {
64376437
DATA_TYPES: {
64386438
EXPENSE: 'expense',
64396439
INVOICE: 'invoice',
6440-
TASK: 'task',
64416440
TRIP: 'trip',
64426441
CHAT: 'chat',
64436442
},
@@ -6506,11 +6505,6 @@ const CONST = {
65066505
LINKS: 'links',
65076506
PINNED: 'pinned',
65086507
},
6509-
TASK: {
6510-
ALL: 'all',
6511-
OUTSTANDING: 'outstanding',
6512-
COMPLETED: 'completed',
6513-
},
65146508
},
65156509
TABLE_COLUMNS: {
65166510
RECEIPT: 'receipt',
@@ -6525,10 +6519,6 @@ const CONST = {
65256519
TYPE: 'type',
65266520
ACTION: 'action',
65276521
TAX_AMOUNT: 'taxAmount',
6528-
TITLE: 'title',
6529-
ASSIGNEE: 'assignee',
6530-
CREATED_BY: 'createdBy',
6531-
IN: 'in',
65326522
},
65336523
SYNTAX_OPERATORS: {
65346524
AND: 'and',
@@ -6569,9 +6559,6 @@ const CONST = {
65696559
PAID: 'paid',
65706560
EXPORTED: 'exported',
65716561
POSTED: 'posted',
6572-
TITLE: 'title',
6573-
ASSIGNEE: 'assignee',
6574-
CREATED_BY: 'createdBy',
65756562
REIMBURSABLE: 'reimbursable',
65766563
BILLABLE: 'billable',
65776564
POLICY_ID: 'policyID',
@@ -6610,9 +6597,6 @@ const CONST = {
66106597
PAID: 'paid',
66116598
EXPORTED: 'exported',
66126599
POSTED: 'posted',
6613-
TITLE: 'title',
6614-
ASSIGNEE: 'assignee',
6615-
CREATED_BY: 'created-by',
66166600
REIMBURSABLE: 'reimbursable',
66176601
BILLABLE: 'billable',
66186602
},

src/ROUTES.ts

-3
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,6 @@ const ROUTES = {
6868
SEARCH_ADVANCED_FILTERS_PAID: 'search/filters/paid',
6969
SEARCH_ADVANCED_FILTERS_EXPORTED: 'search/filters/exported',
7070
SEARCH_ADVANCED_FILTERS_POSTED: 'search/filters/posted',
71-
SEARCH_ADVANCED_FILTERS_TITLE: 'search/filters/title',
72-
SEARCH_ADVANCED_FILTERS_ASSIGNEE: 'search/filters/assignee',
73-
SEARCH_ADVANCED_FILTERS_CREATED_BY: 'search/filters/createdBy',
7471
SEARCH_ADVANCED_FILTERS_REIMBURSABLE: 'search/filters/reimbursable',
7572
SEARCH_ADVANCED_FILTERS_BILLABLE: 'search/filters/billable',
7673
SEARCH_ADVANCED_FILTERS_WORKSPACE: 'search/filters/workspace',

src/SCREENS.ts

-3
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,6 @@ const SCREENS = {
6161
ADVANCED_FILTERS_TAG_RHP: 'Search_Advanced_Filters_Tag_RHP',
6262
ADVANCED_FILTERS_FROM_RHP: 'Search_Advanced_Filters_From_RHP',
6363
ADVANCED_FILTERS_TO_RHP: 'Search_Advanced_Filters_To_RHP',
64-
ADVANCED_FILTERS_TITLE_RHP: 'Search_Advanced_Filters_Title_RHP',
65-
ADVANCED_FILTERS_ASSIGNEE_RHP: 'Search_Advanced_Filters_Assignee_RHP',
66-
ADVANCED_FILTERS_CREATED_BY_RHP: 'Search_Advanced_Filters_Created_By_RHP',
6764
ADVANCED_FILTERS_REIMBURSABLE_RHP: 'Search_Advanced_Filters_Reimbursable_RHP',
6865
ADVANCED_FILTERS_BILLABLE_RHP: 'Search_Advanced_Filters_Billable_RHP',
6966
ADVANCED_FILTERS_WORKSPACE_RHP: 'Search_Advanced_Filters_Workspace_RHP',

src/components/Search/SearchAutocompleteList.tsx

+14-13
Original file line numberDiff line numberDiff line change
@@ -165,13 +165,7 @@ function SearchAutocompleteList(
165165

166166
const typeAutocompleteList = Object.values(CONST.SEARCH.DATA_TYPES);
167167
const groupByAutocompleteList = Object.values(CONST.SEARCH.GROUP_BY);
168-
const statusAutocompleteList = Object.values({
169-
...CONST.SEARCH.STATUS.EXPENSE,
170-
...CONST.SEARCH.STATUS.INVOICE,
171-
...CONST.SEARCH.STATUS.CHAT,
172-
...CONST.SEARCH.STATUS.TRIP,
173-
...CONST.SEARCH.STATUS.TASK,
174-
});
168+
const statusAutocompleteList = Object.values({...CONST.SEARCH.STATUS.EXPENSE, ...CONST.SEARCH.STATUS.INVOICE, ...CONST.SEARCH.STATUS.CHAT, ...CONST.SEARCH.STATUS.TRIP});
175169
const expenseTypes = Object.values(CONST.SEARCH.TRANSACTION_TYPE);
176170
const booleanTypes = Object.values(CONST.SEARCH.BOOLEAN);
177171

@@ -314,21 +308,28 @@ function SearchAutocompleteList(
314308
mapKey: CONST.SEARCH.SYNTAX_FILTER_KEYS.TAX_RATE,
315309
}));
316310
}
317-
case CONST.SEARCH.SYNTAX_FILTER_KEYS.CREATED_BY:
318-
case CONST.SEARCH.SYNTAX_FILTER_KEYS.ASSIGNEE:
319-
case CONST.SEARCH.SYNTAX_FILTER_KEYS.TO:
320311
case CONST.SEARCH.SYNTAX_FILTER_KEYS.FROM: {
321-
const filterKey = autocompleteKey === CONST.SEARCH.SYNTAX_FILTER_KEYS.CREATED_BY ? CONST.SEARCH.SEARCH_USER_FRIENDLY_KEYS.CREATED_BY : autocompleteKey;
312+
const filteredParticipants = getParticipantsAutocompleteList()
313+
.filter((participant) => participant.name.toLowerCase().includes(autocompleteValue.toLowerCase()) && !alreadyAutocompletedKeys.includes(participant.name.toLowerCase()))
314+
.slice(0, 10);
322315

316+
return filteredParticipants.map((participant) => ({
317+
filterKey: CONST.SEARCH.SEARCH_USER_FRIENDLY_KEYS.FROM,
318+
text: participant.name,
319+
autocompleteID: participant.accountID,
320+
mapKey: CONST.SEARCH.SYNTAX_FILTER_KEYS.FROM,
321+
}));
322+
}
323+
case CONST.SEARCH.SYNTAX_FILTER_KEYS.TO: {
323324
const filteredParticipants = getParticipantsAutocompleteList()
324325
.filter((participant) => participant.name.toLowerCase().includes(autocompleteValue.toLowerCase()) && !alreadyAutocompletedKeys.includes(participant.name.toLowerCase()))
325326
.slice(0, 10);
326327

327328
return filteredParticipants.map((participant) => ({
328-
filterKey,
329+
filterKey: CONST.SEARCH.SEARCH_USER_FRIENDLY_KEYS.TO,
329330
text: participant.name,
330331
autocompleteID: participant.accountID,
331-
mapKey: autocompleteKey,
332+
mapKey: CONST.SEARCH.SYNTAX_FILTER_KEYS.TO,
332333
}));
333334
}
334335
case CONST.SEARCH.SYNTAX_FILTER_KEYS.IN: {

src/components/Search/SearchContext.tsx

+12-18
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, {useCallback, useContext, useMemo, useState} from 'react';
2-
import type {ReportActionListItemType, ReportListItemType, TaskListItemType, TransactionListItemType} from '@components/SelectionList/types';
2+
import type {ReportActionListItemType, ReportListItemType, TransactionListItemType} from '@components/SelectionList/types';
33
import {isMoneyRequestReport} from '@libs/ReportUtils';
44
import {isReportListItemType, isTransactionListItemType} from '@libs/SearchUIUtils';
55
import CONST from '@src/CONST';
@@ -27,10 +27,7 @@ const defaultSearchContext: SearchContext = {
2727

2828
const Context = React.createContext<SearchContext>(defaultSearchContext);
2929

30-
function getReportsFromSelectedTransactions(
31-
data: TransactionListItemType[] | ReportListItemType[] | ReportActionListItemType[] | TaskListItemType[],
32-
selectedTransactions: SelectedTransactions,
33-
) {
30+
function getReportsFromSelectedTransactions(data: TransactionListItemType[] | ReportListItemType[] | ReportActionListItemType[], selectedTransactions: SelectedTransactions) {
3431
if (data.length === 0) {
3532
return [];
3633
}
@@ -84,20 +81,17 @@ function SearchContextProvider({children}: ChildrenProps) {
8481
}));
8582
}, []);
8683

87-
const setSelectedTransactions = useCallback(
88-
(selectedTransactions: SelectedTransactions, data: TransactionListItemType[] | ReportListItemType[] | ReportActionListItemType[] | TaskListItemType[]) => {
89-
// When selecting transactions, we also need to manage the reports to which these transactions belong. This is done to ensure proper exporting to CSV.
90-
const selectedReports = getReportsFromSelectedTransactions(data, selectedTransactions);
84+
const setSelectedTransactions = useCallback((selectedTransactions: SelectedTransactions, data: TransactionListItemType[] | ReportListItemType[] | ReportActionListItemType[]) => {
85+
// When selecting transactions, we also need to manage the reports to which these transactions belong. This is done to ensure proper exporting to CSV.
86+
const selectedReports = getReportsFromSelectedTransactions(data, selectedTransactions);
9187

92-
setSearchContextData((prevState) => ({
93-
...prevState,
94-
selectedTransactions,
95-
shouldTurnOffSelectionMode: false,
96-
selectedReports,
97-
}));
98-
},
99-
[],
100-
);
88+
setSearchContextData((prevState) => ({
89+
...prevState,
90+
selectedTransactions,
91+
shouldTurnOffSelectionMode: false,
92+
selectedReports,
93+
}));
94+
}, []);
10195

10296
const clearSelectedTransactions = useCallback(
10397
(searchHash?: number, shouldTurnOffSelectionMode = false) => {

src/components/Search/SearchList.tsx

+13-22
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@ import Modal from '@components/Modal';
1313
import {PressableWithFeedback} from '@components/Pressable';
1414
import type ChatListItem from '@components/SelectionList/ChatListItem';
1515
import type ReportListItem from '@components/SelectionList/Search/ReportListItem';
16-
import type TaskListItem from '@components/SelectionList/Search/TaskListItem';
1716
import type TransactionListItem from '@components/SelectionList/Search/TransactionListItem';
18-
import type {ExtendedTargetedEvent, ReportListItemType, SearchListItem} from '@components/SelectionList/types';
17+
import type {ExtendedTargetedEvent, ReportActionListItemType, ReportListItemType, TransactionListItemType} from '@components/SelectionList/types';
1918
import Text from '@components/Text';
2019
import useArrowKeyFocusManager from '@hooks/useArrowKeyFocusManager';
2120
import useKeyboardShortcut from '@hooks/useKeyboardShortcut';
@@ -32,7 +31,8 @@ import variables from '@styles/variables';
3231
import CONST from '@src/CONST';
3332
import ONYXKEYS from '@src/ONYXKEYS';
3433

35-
type SearchListItemComponentType = typeof TransactionListItem | typeof ChatListItem | typeof ReportListItem | typeof TaskListItem;
34+
type SearchListItem = TransactionListItemType | ReportListItemType | ReportActionListItemType;
35+
type SearchListItemComponentType = typeof TransactionListItem | typeof ChatListItem | typeof ReportListItem;
3636

3737
type SearchListHandle = {
3838
scrollAndHighlightItem?: (items: string[]) => void;
@@ -340,27 +340,19 @@ function SearchList(
340340
],
341341
);
342342

343-
const tableHeaderVisible = canSelectMultiple || !!SearchTableHeader;
344-
const selectAllButtonVisible = canSelectMultiple && !SearchTableHeader;
345-
346343
return (
347344
<View style={[styles.flex1, !isKeyboardShown && safeAreaPaddingBottomStyle, containerStyle]}>
348-
{tableHeaderVisible && (
345+
{canSelectMultiple && (
349346
<View style={[styles.searchListHeaderContainerStyle, styles.listTableHeader]}>
350-
{canSelectMultiple && (
351-
<Checkbox
352-
accessibilityLabel={translate('workspace.people.selectAll')}
353-
isChecked={selectedItemsLength === flattenedTransactions.length}
354-
isIndeterminate={selectedItemsLength > 0 && selectedItemsLength !== flattenedTransactions.length}
355-
onPress={() => {
356-
onAllCheckboxPress();
357-
}}
358-
/>
359-
)}
360-
361-
{SearchTableHeader}
362-
363-
{selectAllButtonVisible && (
347+
<Checkbox
348+
accessibilityLabel={translate('workspace.people.selectAll')}
349+
isChecked={selectedItemsLength === flattenedTransactions.length}
350+
isIndeterminate={selectedItemsLength > 0 && selectedItemsLength !== flattenedTransactions.length}
351+
onPress={() => {
352+
onAllCheckboxPress();
353+
}}
354+
/>
355+
{SearchTableHeader ?? (
364356
<PressableWithFeedback
365357
style={[styles.userSelectNone, styles.alignItemsCenter]}
366358
onPress={onAllCheckboxPress}
@@ -374,7 +366,6 @@ function SearchList(
374366
)}
375367
</View>
376368
)}
377-
378369
<Animated.FlatList
379370
data={data}
380371
renderItem={renderItem}

src/components/Search/SearchPageHeader/SearchStatusBar.tsx

+1-24
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import type {DropdownOption} from '@components/ButtonWithDropdownMenu/types';
99
import * as Expensicons from '@components/Icon/Expensicons';
1010
import ScrollView from '@components/ScrollView';
1111
import {useSearchContext} from '@components/Search/SearchContext';
12-
import type {ChatSearchStatus, ExpenseSearchStatus, InvoiceSearchStatus, SearchGroupBy, SearchQueryJSON, TaskSearchStatus, TripSearchStatus} from '@components/Search/types';
12+
import type {ChatSearchStatus, ExpenseSearchStatus, InvoiceSearchStatus, SearchGroupBy, SearchQueryJSON, TripSearchStatus} from '@components/Search/types';
1313
import SearchStatusSkeleton from '@components/Skeletons/SearchStatusSkeleton';
1414
import useLocalize from '@hooks/useLocalize';
1515
import useNetwork from '@hooks/useNetwork';
@@ -198,27 +198,6 @@ const chatOptions: Array<{type: SearchDataTypes; status: ChatSearchStatus; icon:
198198
},
199199
];
200200

201-
const taskOptions: Array<{type: SearchDataTypes; status: TaskSearchStatus; icon: IconAsset; text: TranslationPaths}> = [
202-
{
203-
type: CONST.SEARCH.DATA_TYPES.TASK,
204-
status: CONST.SEARCH.STATUS.TASK.ALL,
205-
icon: Expensicons.All,
206-
text: 'common.all',
207-
},
208-
{
209-
type: CONST.SEARCH.DATA_TYPES.TASK,
210-
status: CONST.SEARCH.STATUS.TASK.OUTSTANDING,
211-
icon: Expensicons.Hourglass,
212-
text: 'common.outstanding',
213-
},
214-
{
215-
type: CONST.SEARCH.DATA_TYPES.TASK,
216-
status: CONST.SEARCH.STATUS.TASK.COMPLETED,
217-
icon: Expensicons.Checkbox,
218-
text: 'search.filters.completed',
219-
},
220-
];
221-
222201
function getOptions(type: SearchDataTypes, groupBy: SearchGroupBy | undefined) {
223202
switch (type) {
224203
case CONST.SEARCH.DATA_TYPES.INVOICE:
@@ -227,8 +206,6 @@ function getOptions(type: SearchDataTypes, groupBy: SearchGroupBy | undefined) {
227206
return tripOptions;
228207
case CONST.SEARCH.DATA_TYPES.CHAT:
229208
return chatOptions;
230-
case CONST.SEARCH.DATA_TYPES.TASK:
231-
return taskOptions;
232209
case CONST.SEARCH.DATA_TYPES.EXPENSE:
233210
default:
234211
return groupBy === CONST.SEARCH.GROUP_BY.REPORTS ? expenseReportOptions : expenseOptions;

0 commit comments

Comments
 (0)