diff --git a/src/CONST.ts b/src/CONST.ts index 66b51184852f..3097e604c187 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -639,7 +639,6 @@ const CONST = { MEMBER: 'member', }, MAX_COUNT_BEFORE_FOCUS_UPDATE: 30, - MAXIMUM_PARTICIPANTS: 8, SPLIT_REPORTID: '-2', ACTIONS: { LIMIT: 50, diff --git a/src/languages/en.ts b/src/languages/en.ts index 8b7737f00812..6e02520a47cc 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -34,7 +34,6 @@ import type { LogSizeParams, ManagerApprovedAmountParams, ManagerApprovedParams, - MaxParticipantsReachedParams, NewFaceEnterMagicCodeParams, NoLongerHaveAccessParams, NotAllowedExtensionParams, @@ -269,7 +268,6 @@ export default { youAfterPreposition: 'you', your: 'your', conciergeHelp: 'Please reach out to Concierge for help.', - maxParticipantsReached: ({count}: MaxParticipantsReachedParams) => `You've selected the maximum number (${count}) of participants.`, youAppearToBeOffline: 'You appear to be offline.', thisFeatureRequiresInternet: 'This feature requires an active internet connection to be used.', areYouSure: 'Are you sure?', diff --git a/src/languages/es.ts b/src/languages/es.ts index 82b5505b18f4..cc1215e878dd 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -33,7 +33,6 @@ import type { LogSizeParams, ManagerApprovedAmountParams, ManagerApprovedParams, - MaxParticipantsReachedParams, NewFaceEnterMagicCodeParams, NoLongerHaveAccessParams, NotAllowedExtensionParams, @@ -259,7 +258,6 @@ export default { youAfterPreposition: 'ti', your: 'tu', conciergeHelp: 'Por favor, contacta con Concierge para obtener ayuda.', - maxParticipantsReached: ({count}: MaxParticipantsReachedParams) => `Has seleccionado el número máximo (${count}) de participantes.`, youAppearToBeOffline: 'Parece que estás desconectado.', thisFeatureRequiresInternet: 'Esta función requiere una conexión a Internet activa para ser utilizada.', areYouSure: '¿Estás seguro?', diff --git a/src/languages/types.ts b/src/languages/types.ts index 9426e343bbf0..23c892bc73e1 100644 --- a/src/languages/types.ts +++ b/src/languages/types.ts @@ -10,10 +10,6 @@ type CharacterLimitParams = { limit: number; }; -type MaxParticipantsReachedParams = { - count: number; -}; - type ZipCodeExampleFormatParams = { zipSampleFormat: string; }; @@ -333,7 +329,6 @@ export type { LoggedInAsParams, ManagerApprovedAmountParams, ManagerApprovedParams, - MaxParticipantsReachedParams, NewFaceEnterMagicCodeParams, NoLongerHaveAccessParams, NotAllowedExtensionParams, diff --git a/src/libs/OptionsListUtils.ts b/src/libs/OptionsListUtils.ts index 8166036e8e17..5bbbf19f3adb 100644 --- a/src/libs/OptionsListUtils.ts +++ b/src/libs/OptionsListUtils.ts @@ -2117,11 +2117,7 @@ function getMemberInviteOptions( /** * Helper method that returns the text to be used for the header's message and title (if any) */ -function getHeaderMessage(hasSelectableOptions: boolean, hasUserToInvite: boolean, searchValue: string, maxParticipantsReached = false, hasMatchedParticipant = false): string { - if (maxParticipantsReached) { - return Localize.translate(preferredLocale, 'common.maxParticipantsReached', {count: CONST.REPORT.MAXIMUM_PARTICIPANTS}); - } - +function getHeaderMessage(hasSelectableOptions: boolean, hasUserToInvite: boolean, searchValue: string, hasMatchedParticipant = false): string { const isValidPhone = PhoneNumber.parsePhoneNumber(LoginUtils.appendCountryCode(searchValue)).possible; const isValidEmail = Str.isValidEmail(searchValue); @@ -2173,14 +2169,13 @@ function formatSectionsFromSearchTerm( selectedOptions: ReportUtils.OptionData[], filteredRecentReports: ReportUtils.OptionData[], filteredPersonalDetails: ReportUtils.OptionData[], - maxOptionsSelected: boolean, personalDetails: OnyxEntry = {}, shouldGetOptionDetails = false, ): SectionForSearchTerm { // We show the selected participants at the top of the list when there is no search term or maximum number of participants has already been selected // However, if there is a search term we remove the selected participants from the top of the list unless they are part of the search results // This clears up space on mobile views, where if you create a group with 4+ people you can't see the selected participants and the search results at the same time - if (searchTerm === '' || maxOptionsSelected) { + if (searchTerm === '') { return { section: { title: undefined, diff --git a/src/pages/NewChatPage.tsx b/src/pages/NewChatPage.tsx index 3f0c9a23da3f..b20cdfde9903 100755 --- a/src/pages/NewChatPage.tsx +++ b/src/pages/NewChatPage.tsx @@ -73,25 +73,23 @@ function useOptions({isGroupChat}: NewChatPageProps) { undefined, true, ); - const maxParticipantsReached = selectedOptions.length === CONST.REPORT.MAXIMUM_PARTICIPANTS; const headerMessage = OptionsListUtils.getHeaderMessage( filteredOptions.personalDetails.length + filteredOptions.recentReports.length !== 0, Boolean(filteredOptions.userToInvite), debouncedSearchTerm.trim(), - maxParticipantsReached, selectedOptions.some((participant) => participant?.searchText?.toLowerCase?.().includes(debouncedSearchTerm.trim().toLowerCase())), ); - return {...filteredOptions, headerMessage, maxParticipantsReached}; + return {...filteredOptions, headerMessage}; }, [betas, debouncedSearchTerm, isGroupChat, listOptions.personalDetails, listOptions.reports, selectedOptions]); useEffect(() => { - if (!debouncedSearchTerm.length || options.maxParticipantsReached) { + if (!debouncedSearchTerm.length) { return; } Report.searchInServer(debouncedSearchTerm); - }, [debouncedSearchTerm, options.maxParticipantsReached]); + }, [debouncedSearchTerm]); useEffect(() => { if (!newGroupDraft?.participants) { @@ -117,37 +115,22 @@ function NewChatPage({isGroupChat}: NewChatPageProps) { const {insets} = useStyledSafeAreaInsets(); const [isSearchingForReports] = useOnyx(ONYXKEYS.IS_SEARCHING_FOR_REPORTS, {initWithStoredValues: false}); - const { - headerMessage, - maxParticipantsReached, - searchTerm, - debouncedSearchTerm, - setSearchTerm, - selectedOptions, - setSelectedOptions, - recentReports, - personalDetails, - userToInvite, - areOptionsInitialized, - } = useOptions({ - isGroupChat, - }); + const {headerMessage, searchTerm, debouncedSearchTerm, setSearchTerm, selectedOptions, setSelectedOptions, recentReports, personalDetails, userToInvite, areOptionsInitialized} = + useOptions({ + isGroupChat, + }); const [sections, firstKeyForList] = useMemo(() => { const sectionsList: OptionsListUtils.CategorySection[] = []; let firstKey = ''; - const formatResults = OptionsListUtils.formatSectionsFromSearchTerm(debouncedSearchTerm, selectedOptions, recentReports, personalDetails, maxParticipantsReached); + const formatResults = OptionsListUtils.formatSectionsFromSearchTerm(debouncedSearchTerm, selectedOptions, recentReports, personalDetails); sectionsList.push(formatResults.section); if (!firstKey) { firstKey = OptionsListUtils.getFirstKeyForList(formatResults.section.data); } - if (maxParticipantsReached) { - return [sectionsList, firstKey]; - } - sectionsList.push({ title: translate('common.recents'), data: recentReports, @@ -178,7 +161,7 @@ function NewChatPage({isGroupChat}: NewChatPageProps) { } return [sectionsList, firstKey]; - }, [debouncedSearchTerm, selectedOptions, recentReports, personalDetails, maxParticipantsReached, translate, userToInvite]); + }, [debouncedSearchTerm, selectedOptions, recentReports, personalDetails, translate, userToInvite]); /** * Creates a new 1:1 chat with the option and the current user, diff --git a/src/pages/iou/request/MoneyTemporaryForRefactorRequestParticipantsSelector.js b/src/pages/iou/request/MoneyTemporaryForRefactorRequestParticipantsSelector.js index 3a29f35fac8d..9a39ee433ef2 100644 --- a/src/pages/iou/request/MoneyTemporaryForRefactorRequestParticipantsSelector.js +++ b/src/pages/iou/request/MoneyTemporaryForRefactorRequestParticipantsSelector.js @@ -78,8 +78,6 @@ function MoneyTemporaryForRefactorRequestParticipantsSelector({participants, onF const offlineMessage = isOffline ? [`${translate('common.youAppearToBeOffline')} ${translate('search.resultsAreLimited')}`, {isTranslated: true}] : ''; - const maxParticipantsReached = participants.length === CONST.REPORT.MAXIMUM_PARTICIPANTS; - const isIOUSplit = iouType === CONST.IOU.TYPE.SPLIT; const isCategorizeOrShareAction = [CONST.IOU.ACTION.CATEGORIZE, CONST.IOU.ACTION.SHARE].includes(action); @@ -128,22 +126,10 @@ function MoneyTemporaryForRefactorRequestParticipantsSelector({participants, onF isCategorizeOrShareAction ? 0 : undefined, ); - const formatResults = OptionsListUtils.formatSectionsFromSearchTerm( - debouncedSearchTerm, - participants, - chatOptions.recentReports, - chatOptions.personalDetails, - maxParticipantsReached, - personalDetails, - true, - ); + const formatResults = OptionsListUtils.formatSectionsFromSearchTerm(debouncedSearchTerm, participants, chatOptions.recentReports, chatOptions.personalDetails, personalDetails, true); newSections.push(formatResults.section); - if (maxParticipantsReached) { - return [newSections, {}]; - } - newSections.push({ title: translate('common.recents'), data: chatOptions.recentReports, @@ -179,7 +165,6 @@ function MoneyTemporaryForRefactorRequestParticipantsSelector({participants, onF action, canUseP2PDistanceRequests, iouRequestType, - maxParticipantsReached, personalDetails, translate, didScreenTransitionEnd, @@ -255,10 +240,9 @@ function MoneyTemporaryForRefactorRequestParticipantsSelector({participants, onF lodashGet(newChatOptions, 'personalDetails', []).length + lodashGet(newChatOptions, 'recentReports', []).length !== 0, Boolean(newChatOptions.userToInvite), debouncedSearchTerm.trim(), - maxParticipantsReached, lodashSome(participants, (participant) => participant.searchText.toLowerCase().includes(debouncedSearchTerm.trim().toLowerCase())), ), - [maxParticipantsReached, newChatOptions, participants, debouncedSearchTerm], + [newChatOptions, participants, debouncedSearchTerm], ); // Right now you can't split an expense with a workspace and other additional participants diff --git a/tests/perf-test/OptionsListUtils.perf-test.ts b/tests/perf-test/OptionsListUtils.perf-test.ts index 7fd87d9cde17..ddd441f8fae2 100644 --- a/tests/perf-test/OptionsListUtils.perf-test.ts +++ b/tests/perf-test/OptionsListUtils.perf-test.ts @@ -164,7 +164,6 @@ describe('OptionsListUtils', () => { Object.values(selectedOptions), Object.values(filteredRecentReports), Object.values(filteredPersonalDetails), - false, mockedPersonalDetails, true, ), @@ -177,6 +176,6 @@ describe('OptionsListUtils', () => { const mockedPersonalDetails = getMockedPersonalDetails(PERSONAL_DETAILS_COUNT); await waitForBatchedUpdates(); - await measureFunction(() => formatSectionsFromSearchTerm('', Object.values(selectedOptions), [], [], true, mockedPersonalDetails, true)); + await measureFunction(() => formatSectionsFromSearchTerm('', Object.values(selectedOptions), [], [], mockedPersonalDetails, true)); }); });