From 05cbf60ccf5b9dddbeee249d40ecc7979c122e47 Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Thu, 6 Apr 2023 08:20:59 +0200 Subject: [PATCH] Management / Group: Fix invalid permissions count (#2939) --- src/components/right/management/ManageGroup.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/right/management/ManageGroup.tsx b/src/components/right/management/ManageGroup.tsx index bb26ffcea..07434e528 100644 --- a/src/components/right/management/ManageGroup.tsx +++ b/src/components/right/management/ManageGroup.tsx @@ -277,7 +277,10 @@ const ManageGroup: FC = ({ } let totalCount = ALL_PERMISSIONS.filter( - (key) => !chat.defaultBannedRights![key as keyof ApiChatBannedRights], + (key) => { + if (key === 'manageTopics' && !isForumEnabled) return false; + return !chat.defaultBannedRights![key as keyof ApiChatBannedRights]; + }, ).length; const { sendStickers, sendGifs } = chat.defaultBannedRights; @@ -288,7 +291,7 @@ const ManageGroup: FC = ({ } return totalCount; - }, [chat]); + }, [chat.defaultBannedRights, isForumEnabled]); const adminsCount = useMemo(() => { return Object.keys(chat.fullInfo?.adminMembersById || {}).length;