From ab389ba6796c425f05e784e0135fbc35fca0a3d7 Mon Sep 17 00:00:00 2001 From: Tomasz Palys Date: Tue, 17 Sep 2024 11:20:13 +0200 Subject: [PATCH] [web] Remove admins tab when there are no admins Summary: In thick threads there are no admins, so it doesn't make sense to show an empty tab. Instead of hiding the tab just for thick threads, we can hide the tab every time there are no admins. {F2726583} {F2726584} https://linear.app/comm/issue/ENG-9258/remove-admins-tab-in-thick-threads Test Plan: Open a members menu in a thread with some admins and check if both tabs appear. Open it in a thick thread and check if only the members tab is present. Reviewers: kamil, will Reviewed By: will Differential Revision: https://phab.comm.dev/D13359 --- .../threads/members/members-modal.react.js | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/web/modals/threads/members/members-modal.react.js b/web/modals/threads/members/members-modal.react.js index 1874f19029..d8394aa0a4 100644 --- a/web/modals/threads/members/members-modal.react.js +++ b/web/modals/threads/members/members-modal.react.js @@ -86,15 +86,25 @@ function ThreadMembersModalContent(props: ContentProps): React.Node { ); }, [adminMembers, allMembers, tab, threadInfo]); - const threadMembersModalContent = React.useMemo( - () => ( + const threadMembersModalContent = React.useMemo(() => { + if (adminMembers.length === 0) { + return ( +
+ +
+ ); + } + + return (
{tabs}
{tabContent}
- ), - [tabContent, tabs], - ); + ); + }, [tabContent, tabs, adminMembers.length, allMembers, threadInfo]); return threadMembersModalContent; }