Management / Group: Fix invalid permissions count (#2939)

This commit is contained in:
Alexander Zinchuk 2023-04-06 08:20:59 +02:00
parent 690c77c3b5
commit 05cbf60ccf

View File

@ -277,7 +277,10 @@ const ManageGroup: FC<OwnProps & StateProps> = ({
} }
let totalCount = ALL_PERMISSIONS.filter( 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; ).length;
const { sendStickers, sendGifs } = chat.defaultBannedRights; const { sendStickers, sendGifs } = chat.defaultBannedRights;
@ -288,7 +291,7 @@ const ManageGroup: FC<OwnProps & StateProps> = ({
} }
return totalCount; return totalCount;
}, [chat]); }, [chat.defaultBannedRights, isForumEnabled]);
const adminsCount = useMemo(() => { const adminsCount = useMemo(() => {
return Object.keys(chat.fullInfo?.adminMembersById || {}).length; return Object.keys(chat.fullInfo?.adminMembersById || {}).length;