From cb4b1bf262fefb69192f303698bf4af37ed077d4 Mon Sep 17 00:00:00 2001 From: GandalfGwaihir Date: Fri, 19 Apr 2024 14:48:29 +0530 Subject: [PATCH 01/10] Do not limit the number of participants in a group chat --- src/pages/NewChatPage.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/NewChatPage.tsx b/src/pages/NewChatPage.tsx index 5f14f8576cb5..ff153d682865 100755 --- a/src/pages/NewChatPage.tsx +++ b/src/pages/NewChatPage.tsx @@ -69,7 +69,8 @@ function useOptions({isGroupChat}: NewChatPageProps) { [], true, ); - const maxParticipantsReached = selectedOptions.length === CONST.REPORT.MAXIMUM_PARTICIPANTS; + // We no longer limit the number of participants in a group chat + const maxParticipantsReached = false; const headerMessage = OptionsListUtils.getHeaderMessage( filteredOptions.personalDetails.length + filteredOptions.recentReports.length !== 0, From b4a7f0a61356b49a7fe45b414f788aadf9f20313 Mon Sep 17 00:00:00 2001 From: GandalfGwaihir Date: Wed, 24 Apr 2024 05:08:56 +0530 Subject: [PATCH 02/10] Remove the use of max participants completely --- src/pages/NewChatPage.tsx | 35 ++++++++++------------------------- 1 file changed, 10 insertions(+), 25 deletions(-) diff --git a/src/pages/NewChatPage.tsx b/src/pages/NewChatPage.tsx index ff153d682865..bd32748e5d57 100755 --- a/src/pages/NewChatPage.tsx +++ b/src/pages/NewChatPage.tsx @@ -76,19 +76,19 @@ function useOptions({isGroupChat}: NewChatPageProps) { filteredOptions.personalDetails.length + filteredOptions.recentReports.length !== 0, Boolean(filteredOptions.userToInvite), debouncedSearchTerm.trim(), - maxParticipantsReached, + false, 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) { @@ -114,37 +114,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, false); 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, @@ -175,7 +160,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, From a630a5303ac2676e7062182932fc9efaf5d7c8d4 Mon Sep 17 00:00:00 2001 From: GandalfGwaihir Date: Wed, 24 Apr 2024 05:10:29 +0530 Subject: [PATCH 03/10] Remove variable declaration --- src/pages/NewChatPage.tsx | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/pages/NewChatPage.tsx b/src/pages/NewChatPage.tsx index bd32748e5d57..fa7f323620db 100755 --- a/src/pages/NewChatPage.tsx +++ b/src/pages/NewChatPage.tsx @@ -69,8 +69,6 @@ function useOptions({isGroupChat}: NewChatPageProps) { [], true, ); - // We no longer limit the number of participants in a group chat - const maxParticipantsReached = false; const headerMessage = OptionsListUtils.getHeaderMessage( filteredOptions.personalDetails.length + filteredOptions.recentReports.length !== 0, @@ -114,10 +112,20 @@ function NewChatPage({isGroupChat}: NewChatPageProps) { const {insets} = useStyledSafeAreaInsets(); const [isSearchingForReports] = useOnyx(ONYXKEYS.IS_SEARCHING_FOR_REPORTS, {initWithStoredValues: false}); - const {headerMessage, 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[] = []; @@ -130,6 +138,8 @@ function NewChatPage({isGroupChat}: NewChatPageProps) { firstKey = OptionsListUtils.getFirstKeyForList(formatResults.section.data); } + + sectionsList.push({ title: translate('common.recents'), data: recentReports, From 884e17df20437af51527662283de83a8548b87b8 Mon Sep 17 00:00:00 2001 From: GandalfGwaihir Date: Wed, 24 Apr 2024 05:12:01 +0530 Subject: [PATCH 04/10] remove extra whitespace --- src/pages/NewChatPage.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/pages/NewChatPage.tsx b/src/pages/NewChatPage.tsx index fa7f323620db..f8bf9414e7e3 100755 --- a/src/pages/NewChatPage.tsx +++ b/src/pages/NewChatPage.tsx @@ -138,8 +138,6 @@ function NewChatPage({isGroupChat}: NewChatPageProps) { firstKey = OptionsListUtils.getFirstKeyForList(formatResults.section.data); } - - sectionsList.push({ title: translate('common.recents'), data: recentReports, From a8b53ee51ced5e04dccbc23b79cede7272b5bcd8 Mon Sep 17 00:00:00 2001 From: GandalfGwaihir Date: Wed, 24 Apr 2024 05:42:55 +0530 Subject: [PATCH 05/10] fix lint --- src/pages/NewChatPage.tsx | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/pages/NewChatPage.tsx b/src/pages/NewChatPage.tsx index f8bf9414e7e3..466f3d4139cf 100755 --- a/src/pages/NewChatPage.tsx +++ b/src/pages/NewChatPage.tsx @@ -112,20 +112,10 @@ function NewChatPage({isGroupChat}: NewChatPageProps) { const {insets} = useStyledSafeAreaInsets(); const [isSearchingForReports] = useOnyx(ONYXKEYS.IS_SEARCHING_FOR_REPORTS, {initWithStoredValues: false}); - const { - headerMessage, - 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[] = []; From 5f864fc94a588f8d9d261eebdb4a1ed0b37d5fac Mon Sep 17 00:00:00 2001 From: GandalfGwaihir Date: Mon, 29 Apr 2024 16:37:28 +0530 Subject: [PATCH 06/10] Remove limit for split bill participant selector --- src/libs/OptionsListUtils.ts | 9 ++------- src/pages/NewChatPage.tsx | 3 +-- ...yForRefactorRequestParticipantsSelector.js | 19 ++----------------- 3 files changed, 5 insertions(+), 26 deletions(-) diff --git a/src/libs/OptionsListUtils.ts b/src/libs/OptionsListUtils.ts index c11a1499a88f..0c1795774ebd 100644 --- a/src/libs/OptionsListUtils.ts +++ b/src/libs/OptionsListUtils.ts @@ -2131,11 +2131,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); @@ -2187,14 +2183,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 466f3d4139cf..accd2497fefe 100755 --- a/src/pages/NewChatPage.tsx +++ b/src/pages/NewChatPage.tsx @@ -74,7 +74,6 @@ function useOptions({isGroupChat}: NewChatPageProps) { filteredOptions.personalDetails.length + filteredOptions.recentReports.length !== 0, Boolean(filteredOptions.userToInvite), debouncedSearchTerm.trim(), - false, selectedOptions.some((participant) => participant?.searchText?.toLowerCase?.().includes(debouncedSearchTerm.trim().toLowerCase())), ); return {...filteredOptions, headerMessage}; @@ -121,7 +120,7 @@ function NewChatPage({isGroupChat}: NewChatPageProps) { const sectionsList: OptionsListUtils.CategorySection[] = []; let firstKey = ''; - const formatResults = OptionsListUtils.formatSectionsFromSearchTerm(debouncedSearchTerm, selectedOptions, recentReports, personalDetails, false); + const formatResults = OptionsListUtils.formatSectionsFromSearchTerm(debouncedSearchTerm, selectedOptions, recentReports, personalDetails); sectionsList.push(formatResults.section); if (!firstKey) { diff --git a/src/pages/iou/request/MoneyTemporaryForRefactorRequestParticipantsSelector.js b/src/pages/iou/request/MoneyTemporaryForRefactorRequestParticipantsSelector.js index 95cb043122d4..eb2f3bcdda3d 100644 --- a/src/pages/iou/request/MoneyTemporaryForRefactorRequestParticipantsSelector.js +++ b/src/pages/iou/request/MoneyTemporaryForRefactorRequestParticipantsSelector.js @@ -82,7 +82,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 {isSmallScreenWidth} = useWindowDimensions(); useEffect(() => { @@ -122,22 +121,10 @@ function MoneyTemporaryForRefactorRequestParticipantsSelector({participants, onF false, ); - 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, @@ -175,7 +162,6 @@ function MoneyTemporaryForRefactorRequestParticipantsSelector({participants, onF action, canUseP2PDistanceRequests, iouRequestType, - maxParticipantsReached, personalDetails, translate, didScreenTransitionEnd, @@ -250,10 +236,9 @@ function MoneyTemporaryForRefactorRequestParticipantsSelector({participants, onF _.get(newChatOptions, 'personalDetails', []).length + _.get(newChatOptions, 'recentReports', []).length !== 0, Boolean(newChatOptions.userToInvite), debouncedSearchTerm.trim(), - maxParticipantsReached, _.some(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 From f93ad7b94f7bdf86ae88abd009a1e28a48f1b829 Mon Sep 17 00:00:00 2001 From: GandalfGwaihir Date: Mon, 29 Apr 2024 16:40:58 +0530 Subject: [PATCH 07/10] Remove extra prop from tests --- tests/perf-test/OptionsListUtils.perf-test.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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)); }); }); From c512134ede2ab280704b8647a3099c5c33685f12 Mon Sep 17 00:00:00 2001 From: GandalfGwaihir Date: Mon, 29 Apr 2024 16:46:11 +0530 Subject: [PATCH 08/10] resolve Merge conflict --- ...emporaryForRefactorRequestParticipantsSelector.js | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/pages/iou/request/MoneyTemporaryForRefactorRequestParticipantsSelector.js b/src/pages/iou/request/MoneyTemporaryForRefactorRequestParticipantsSelector.js index 15cd36ffd9aa..d89b09097af2 100644 --- a/src/pages/iou/request/MoneyTemporaryForRefactorRequestParticipantsSelector.js +++ b/src/pages/iou/request/MoneyTemporaryForRefactorRequestParticipantsSelector.js @@ -78,14 +78,8 @@ function MoneyTemporaryForRefactorRequestParticipantsSelector({participants, onF const offlineMessage = isOffline ? [`${translate('common.youAppearToBeOffline')} ${translate('search.resultsAreLimited')}`, {isTranslated: true}] : ''; -<<<<<<< HEAD - const {isSmallScreenWidth} = useWindowDimensions(); -======= - 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); ->>>>>>> 19c92231511da97880d0cf5c59ae89f7bd7b447e useEffect(() => { Report.searchInServer(debouncedSearchTerm.trim()); @@ -246,12 +240,8 @@ function MoneyTemporaryForRefactorRequestParticipantsSelector({participants, onF lodashGet(newChatOptions, 'personalDetails', []).length + lodashGet(newChatOptions, 'recentReports', []).length !== 0, Boolean(newChatOptions.userToInvite), debouncedSearchTerm.trim(), -<<<<<<< HEAD - _.some(participants, (participant) => participant.searchText.toLowerCase().includes(debouncedSearchTerm.trim().toLowerCase())), -======= - maxParticipantsReached, + lodashSome(participants, (participant) => participant.searchText.toLowerCase().includes(debouncedSearchTerm.trim().toLowerCase())), ->>>>>>> 19c92231511da97880d0cf5c59ae89f7bd7b447e ), [newChatOptions, participants, debouncedSearchTerm], ); From 47ba4a2c9c6e380d6f9e9ef01817dcb6fe5b1e38 Mon Sep 17 00:00:00 2001 From: Gandalf Date: Tue, 30 Apr 2024 04:35:40 +0530 Subject: [PATCH 09/10] Update src/pages/iou/request/MoneyTemporaryForRefactorRequestParticipantsSelector.js Co-authored-by: ahmedGaber93 <41129870+ahmedGaber93@users.noreply.github.com> --- .../MoneyTemporaryForRefactorRequestParticipantsSelector.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pages/iou/request/MoneyTemporaryForRefactorRequestParticipantsSelector.js b/src/pages/iou/request/MoneyTemporaryForRefactorRequestParticipantsSelector.js index d89b09097af2..9a39ee433ef2 100644 --- a/src/pages/iou/request/MoneyTemporaryForRefactorRequestParticipantsSelector.js +++ b/src/pages/iou/request/MoneyTemporaryForRefactorRequestParticipantsSelector.js @@ -240,7 +240,6 @@ function MoneyTemporaryForRefactorRequestParticipantsSelector({participants, onF lodashGet(newChatOptions, 'personalDetails', []).length + lodashGet(newChatOptions, 'recentReports', []).length !== 0, Boolean(newChatOptions.userToInvite), debouncedSearchTerm.trim(), - lodashSome(participants, (participant) => participant.searchText.toLowerCase().includes(debouncedSearchTerm.trim().toLowerCase())), ), [newChatOptions, participants, debouncedSearchTerm], From 71d0830f92697e191577f3817114769fdeb11d6f Mon Sep 17 00:00:00 2001 From: GandalfGwaihir Date: Tue, 30 Apr 2024 04:40:41 +0530 Subject: [PATCH 10/10] Remove restrictions on split expenses --- src/CONST.ts | 1 - src/languages/en.ts | 2 -- src/languages/es.ts | 2 -- src/languages/types.ts | 5 ----- 4 files changed, 10 deletions(-) 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,