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
6 changes: 3 additions & 3 deletions src/components/Search/SearchAutocompleteList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@
if (!areOptionsInitialized) {
return defaultListOptions;
}
return getSearchOptions(options, betas ?? [], true, true, autocompleteQueryValue, CONST.AUTO_COMPLETE_SUGGESTER.MAX_AMOUNT_OF_SUGGESTIONS, true);
return getSearchOptions(options, betas ?? [], true, true, autocompleteQueryValue, CONST.AUTO_COMPLETE_SUGGESTER.MAX_AMOUNT_OF_SUGGESTIONS, true, true, false, true);
}, [areOptionsInitialized, betas, options, autocompleteQueryValue]);

const [isInitialRender, setIsInitialRender] = useState(true);
Expand Down Expand Up @@ -361,7 +361,7 @@
case CONST.SEARCH.SYNTAX_FILTER_KEYS.FROM:
case CONST.SEARCH.SYNTAX_FILTER_KEYS.PAYER:
case CONST.SEARCH.SYNTAX_FILTER_KEYS.EXPORTER: {
const participants = getSearchOptions(options, betas ?? [], true, true, autocompleteValue, 10, false, false, true).personalDetails.filter(
const participants = getSearchOptions(options, betas ?? [], true, true, autocompleteValue, 10, false, false, true, true).personalDetails.filter(
(participant) => participant.text && !alreadyAutocompletedKeys.includes(participant.text.toLowerCase()),
);

Expand All @@ -373,7 +373,7 @@
}));
}
case CONST.SEARCH.SYNTAX_FILTER_KEYS.IN: {
const filteredReports = getSearchOptions(options, betas ?? [], true, true, autocompleteValue, 10, false, true).recentReports;
const filteredReports = getSearchOptions(options, betas ?? [], true, true, autocompleteValue, 10, false, true, false, true).recentReports;

return filteredReports.map((chat) => ({
filterKey: CONST.SEARCH.SEARCH_USER_FRIENDLY_KEYS.IN,
Expand Down Expand Up @@ -498,7 +498,7 @@
return [];
}
}
}, [

Check warning on line 501 in src/components/Search/SearchAutocompleteList.tsx

View workflow job for this annotation

GitHub Actions / ESLint check

React Hook useMemo has a missing dependency: 'actionTypes'. Either include it or remove the dependency array

Check warning on line 501 in src/components/Search/SearchAutocompleteList.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

React Hook useMemo has a missing dependency: 'actionTypes'. Either include it or remove the dependency array
autocompleteParsedQuery,
autocompleteQueryValue,
tagAutocompleteList,
Expand Down
18 changes: 15 additions & 3 deletions src/libs/OptionsListUtils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@
*/
let currentUserLogin: string | undefined;
let currentUserAccountID: number | undefined;
Onyx.connect({

Check warning on line 186 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 @@ -192,19 +192,19 @@
});

let loginList: OnyxEntry<Login>;
Onyx.connect({

Check warning on line 195 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.LOGIN_LIST,
callback: (value) => (loginList = isEmptyObject(value) ? {} : value),
});

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

Check warning on line 201 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 207 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 @@ -216,14 +216,14 @@
});

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

Check warning on line 219 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 226 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 @@ -232,7 +232,7 @@
});

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

Check warning on line 235 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 @@ -244,7 +244,7 @@
const allSortedReportActions: Record<string, ReportAction[]> = {};
let allReportActions: OnyxCollection<ReportActions>;
const lastVisibleReportActions: ReportActions = {};
Onyx.connect({

Check warning on line 247 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 @@ -303,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 @@ -809,8 +809,9 @@
}

// Type/category flags already set in initialization above, but update brickRoadIndicator
result.allReportErrors = reportAttributesDerived?.[report.reportID]?.reportErrors ?? {};
result.brickRoadIndicator = !isEmptyObject(result.allReportErrors) ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : '';
const reportAttribute = reportAttributesDerived?.[report.reportID];
result.allReportErrors = reportAttribute?.reportErrors ?? {};
result.brickRoadIndicator = !isEmptyObject(result.allReportErrors) ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : (reportAttribute?.brickRoadStatus ?? '');

// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- below is a boolean expression
hasMultipleParticipants = personalDetailList.length > 1 || result.isChatRoom || result.isPolicyExpenseChat || reportUtilsIsGroupChat(report);
Expand Down Expand Up @@ -1604,6 +1605,7 @@
shouldSeparateWorkspaceChat,
isPerDiemRequest = false,
showRBR = true,
shouldShowGBR = false,
} = config;

const validReportOptions: SearchOptionData[] = [];
Expand Down Expand Up @@ -1648,6 +1650,10 @@
brickRoadIndicator: showRBR ? option.brickRoadIndicator : null,
};

if (newReportOption.brickRoadIndicator === CONST.BRICK_ROAD_INDICATOR_STATUS.INFO) {
newReportOption.brickRoadIndicator = shouldShowGBR ? CONST.BRICK_ROAD_INDICATOR_STATUS.INFO : null;
}

if (shouldSeparateWorkspaceChat && newReportOption.isPolicyExpenseChat && !newReportOption.private_isArchived) {
newReportOption.text = getPolicyName({report});
newReportOption.alternateText = translateLocal('workspace.common.workspace');
Expand Down Expand Up @@ -1750,7 +1756,7 @@
loginsToExclude[option.login] = true;
});
}
const {includeP2P = true, shouldBoldTitleByDefault = true, includeDomainEmail = false, ...getValidReportsConfig} = config;
const {includeP2P = true, shouldBoldTitleByDefault = true, includeDomainEmail = false, shouldShowGBR = false, ...getValidReportsConfig} = config;

let filteredReports = options.reports;

Expand Down Expand Up @@ -1801,6 +1807,7 @@
shouldBoldTitleByDefault,
shouldSeparateSelfDMChat,
shouldSeparateWorkspaceChat,
shouldShowGBR,
});

recentReportOptions = recentReports;
Expand Down Expand Up @@ -1865,6 +1872,9 @@
currentUserRef.current = personalDetail;
}
personalDetail.isBold = shouldBoldTitleByDefault;
if (personalDetail.brickRoadIndicator === CONST.BRICK_ROAD_INDICATOR_STATUS.INFO) {
personalDetail.brickRoadIndicator = shouldShowGBR ? CONST.BRICK_ROAD_INDICATOR_STATUS.INFO : '';
}
}
}

Expand Down Expand Up @@ -1900,6 +1910,7 @@
includeUserToInvite?: boolean,
includeRecentReports = true,
includeCurrentUser = false,
shouldShowGBR = false,
): Options {
Timing.start(CONST.TIMING.LOAD_SEARCH_OPTIONS);
Performance.markStart(CONST.TIMING.LOAD_SEARCH_OPTIONS);
Expand All @@ -1921,6 +1932,7 @@
includeCurrentUser,
searchString: searchQuery,
includeUserToInvite,
shouldShowGBR,
});

Timing.end(CONST.TIMING.LOAD_SEARCH_OPTIONS);
Expand Down
1 change: 1 addition & 0 deletions src/libs/OptionsListUtils/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ type GetValidReportsConfig = {
excludeNonAdminWorkspaces?: boolean;
isPerDiemRequest?: boolean;
showRBR?: boolean;
shouldShowGBR?: boolean;
} & GetValidOptionsSharedConfig;

type GetValidReportsReturnTypeCombined = {
Expand Down
Loading