From 57b94fae6d891961cdb5d010f44398cbbad6dd98 Mon Sep 17 00:00:00 2001 From: xsanm Date: Tue, 24 Sep 2024 15:24:56 +0200 Subject: [PATCH] [web][native] hide media gallery for thick threads Summary: [ENG-9315](https://linear.app/comm/issue/ENG-9315/media-tab-is-empty-for-thick-threads-on-the-web). Hiding media gallery for thick threads. Test Plan: 1. On web and native this in not possible to access/see media gallery for thick threads. 1. For thin threads it works as previously. Reviewers: tomek Reviewed By: tomek Subscribers: ashoat Differential Revision: https://phab.comm.dev/D13448 --- native/chat/settings/thread-settings.react.js | 5 +++++ web/chat/thread-menu.react.js | 12 +++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/native/chat/settings/thread-settings.react.js b/native/chat/settings/thread-settings.react.js index 80d967f802..87cf0354a1 100644 --- a/native/chat/settings/thread-settings.react.js +++ b/native/chat/settings/thread-settings.react.js @@ -48,6 +48,7 @@ import { threadPermissions } from 'lib/types/thread-permission-types.js'; import { threadTypes, threadTypeIsSidebar, + threadTypeIsThick, } from 'lib/types/thread-types-enum.js'; import type { UserInfos } from 'lib/types/user-types.js'; import { @@ -702,6 +703,10 @@ class ThreadSettings extends React.PureComponent { const listData: ChatSettingsItem[] = []; const limit = 6; + if (threadTypeIsThick(threadInfo.type)) { + return listData; + } + listData.push({ itemType: 'mediaGallery', key: 'mediaGallery', diff --git a/web/chat/thread-menu.react.js b/web/chat/thread-menu.react.js index e5c4a9bf6d..56338580e3 100644 --- a/web/chat/thread-menu.react.js +++ b/web/chat/thread-menu.react.js @@ -106,17 +106,19 @@ function ThreadMenu(props: ThreadMenuProps): React.Node { [popModal, pushModal, threadInfo], ); - const threadMediaGalleryItem = React.useMemo( - () => ( + const threadMediaGalleryItem = React.useMemo(() => { + if (threadTypeIsThick(threadInfo.type)) { + return null; + } + return ( - ), - [onClickThreadMediaGallery], - ); + ); + }, [onClickThreadMediaGallery, threadInfo.type]); const childThreads = useSelector( state => childThreadInfos(state)[threadInfo.id],