From 58663255a5c7d8eaf92eb41dd27b93998426bda7 Mon Sep 17 00:00:00 2001 From: Anusha Date: Wed, 16 Oct 2024 23:49:06 +0500 Subject: [PATCH 1/5] hide expensify from new chat page --- src/libs/OptionsListUtils.ts | 2 +- src/pages/NewChatPage.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/OptionsListUtils.ts b/src/libs/OptionsListUtils.ts index fbf2f3b94c7c..1ede98338f87 100644 --- a/src/libs/OptionsListUtils.ts +++ b/src/libs/OptionsListUtils.ts @@ -1994,7 +1994,7 @@ function getOptions( allPersonalDetailsOptions = lodashOrderBy(allPersonalDetailsOptions, [(personalDetail) => personalDetail.text?.toLowerCase()], 'asc'); } - const optionsToExclude: Option[] = []; + const optionsToExclude: Option[] = [{login: CONST.EMAIL.NOTIFICATIONS}]; // If we're including selected options from the search results, we only want to exclude them if the search input is empty // This is because on certain pages, we show the selected options at the top when the search input is empty diff --git a/src/pages/NewChatPage.tsx b/src/pages/NewChatPage.tsx index c406f7f3058c..494e099933fe 100755 --- a/src/pages/NewChatPage.tsx +++ b/src/pages/NewChatPage.tsx @@ -229,7 +229,7 @@ function NewChatPage({isGroupChat}: NewChatPageProps) { const itemRightSideComponent = useCallback( (item: ListItem & OptionsListUtils.Option, isFocused?: boolean) => { - if (!!item.isSelfDM || (item.accountID && CONST.NON_ADDABLE_ACCOUNT_IDS.includes(item.accountID))) { + if (!!item.isSelfDM || (item.login && excludedGroupEmails.includes(item.login))) { return null; } /** From 039f0d6982b91199c18400bf4bafccfa3a0a6390 Mon Sep 17 00:00:00 2001 From: Anusha Date: Thu, 17 Oct 2024 00:12:55 +0500 Subject: [PATCH 2/5] fix type error --- src/pages/NewChatPage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/NewChatPage.tsx b/src/pages/NewChatPage.tsx index 494e099933fe..bd3e30a48cf4 100755 --- a/src/pages/NewChatPage.tsx +++ b/src/pages/NewChatPage.tsx @@ -38,7 +38,7 @@ type NewChatPageProps = { isGroupChat?: boolean; }; -const excludedGroupEmails = CONST.EXPENSIFY_EMAILS.filter((value) => value !== CONST.EMAIL.CONCIERGE); +const excludedGroupEmails: Array = CONST.EXPENSIFY_EMAILS.filter((value) => value !== CONST.EMAIL.CONCIERGE); function useOptions({isGroupChat}: NewChatPageProps) { const [searchTerm, debouncedSearchTerm, setSearchTerm] = useDebouncedState(''); From 0fd9a41a1e274fbf11b4d7c0b8aef6f9ade3d4aa Mon Sep 17 00:00:00 2001 From: Anusha Date: Thu, 17 Oct 2024 00:28:04 +0500 Subject: [PATCH 3/5] fix lint error --- src/pages/NewChatPage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/NewChatPage.tsx b/src/pages/NewChatPage.tsx index bd3e30a48cf4..5b44659babab 100755 --- a/src/pages/NewChatPage.tsx +++ b/src/pages/NewChatPage.tsx @@ -38,7 +38,7 @@ type NewChatPageProps = { isGroupChat?: boolean; }; -const excludedGroupEmails: Array = CONST.EXPENSIFY_EMAILS.filter((value) => value !== CONST.EMAIL.CONCIERGE); +const excludedGroupEmails: string[] = CONST.EXPENSIFY_EMAILS.filter((value) => value !== CONST.EMAIL.CONCIERGE); function useOptions({isGroupChat}: NewChatPageProps) { const [searchTerm, debouncedSearchTerm, setSearchTerm] = useDebouncedState(''); From 1a6950b7c7909d251c5257ed2661fcc66285c803 Mon Sep 17 00:00:00 2001 From: Anusha Date: Thu, 24 Oct 2024 04:52:37 +0500 Subject: [PATCH 4/5] remove is group chat --- src/pages/NewChatPage.tsx | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/src/pages/NewChatPage.tsx b/src/pages/NewChatPage.tsx index 97712a0fa9d4..c28290e353e7 100755 --- a/src/pages/NewChatPage.tsx +++ b/src/pages/NewChatPage.tsx @@ -34,13 +34,9 @@ import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import type {SelectedParticipant} from '@src/types/onyx/NewGroupChatDraft'; -type NewChatPageProps = { - isGroupChat?: boolean; -}; - const excludedGroupEmails: string[] = CONST.EXPENSIFY_EMAILS.filter((value) => value !== CONST.EMAIL.CONCIERGE); -function useOptions({isGroupChat}: NewChatPageProps) { +function useOptions() { const [searchTerm, debouncedSearchTerm, setSearchTerm] = useDebouncedState(''); const [selectedOptions, setSelectedOptions] = useState>([]); const [betas] = useOnyx(ONYXKEYS.BETAS); @@ -57,22 +53,20 @@ function useOptions({isGroupChat}: NewChatPageProps) { personalDetails: listOptions.personalDetails ?? [], betas: betas ?? [], selectedOptions, - excludeLogins: isGroupChat ? excludedGroupEmails : [], maxRecentReportsToShow: 0, includeSelfDM: true, }); return filteredOptions; - }, [betas, isGroupChat, listOptions.personalDetails, listOptions.reports, selectedOptions]); + }, [betas, listOptions.personalDetails, listOptions.reports, selectedOptions]); const options = useMemo(() => { const filteredOptions = OptionsListUtils.filterOptions(defaultOptions, debouncedSearchTerm, { selectedOptions, - excludeLogins: isGroupChat ? excludedGroupEmails : [], maxRecentReportsToShow: CONST.IOU.MAX_RECENT_REPORTS_TO_SHOW, }); return filteredOptions; - }, [debouncedSearchTerm, defaultOptions, isGroupChat, selectedOptions]); + }, [debouncedSearchTerm, defaultOptions, selectedOptions]); const cleanSearchTerm = useMemo(() => debouncedSearchTerm.trim().toLowerCase(), [debouncedSearchTerm]); const headerMessage = useMemo(() => { return OptionsListUtils.getHeaderMessage( @@ -129,7 +123,7 @@ function useOptions({isGroupChat}: NewChatPageProps) { }; } -function NewChatPage({isGroupChat}: NewChatPageProps) { +function NewChatPage() { const {translate} = useLocalize(); const {isOffline} = useNetwork(); // We need to use isSmallScreenWidth instead of shouldUseNarrowLayout to show offline indicator on small screen only @@ -142,9 +136,7 @@ function NewChatPage({isGroupChat}: NewChatPageProps) { const selectionListRef = useRef(null); const {headerMessage, searchTerm, debouncedSearchTerm, setSearchTerm, selectedOptions, setSelectedOptions, recentReports, personalDetails, userToInvite, areOptionsInitialized} = - useOptions({ - isGroupChat, - }); + useOptions(); const [sections, firstKeyForList] = useMemo(() => { const sectionsList: OptionsListUtils.CategorySection[] = []; From 6916c06d369b43dda2d2d67345322478afe3a8f4 Mon Sep 17 00:00:00 2001 From: Anusha Date: Tue, 29 Oct 2024 18:47:31 +0500 Subject: [PATCH 5/5] remove unused var --- src/CONST.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/CONST.ts b/src/CONST.ts index 8e240ac43ca1..0b8898f2fbfd 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -2910,10 +2910,6 @@ const CONST = { get RESTRICTED_ACCOUNT_IDS() { return [this.ACCOUNT_ID.NOTIFICATIONS]; }, - // Account IDs that can't be added as a group member - get NON_ADDABLE_ACCOUNT_IDS() { - return [this.ACCOUNT_ID.NOTIFICATIONS, this.ACCOUNT_ID.CHRONOS]; - }, // Auth limit is 60k for the column but we store edits and other metadata along the html so let's use a lower limit to accommodate for it. MAX_COMMENT_LENGTH: 10000,