Forum: Fix topic creation permission check (#2322)

This commit is contained in:
Alexander Zinchuk 2023-01-22 18:12:22 +01:00
parent c702f65148
commit 2d23ec775e

View File

@ -29,6 +29,7 @@ import {
isChatGroup,
getCanManageTopic,
isUserRightBanned,
getHasAdminRight,
} from '../../global/helpers';
import useShowTransition from '../../hooks/useShowTransition';
import usePrevDuringAnimation from '../../hooks/usePrevDuringAnimation';
@ -554,7 +555,9 @@ export default memo(withGlobal<OwnProps>(
);
const topic = chat?.topics?.[threadId];
const canCreateTopic = chat.isForum && !isUserRightBanned(chat, 'manageTopics');
const canCreateTopic = chat.isForum && (
chat.isCreator || !isUserRightBanned(chat, 'manageTopics') || getHasAdminRight(chat, 'manageTopics')
);
const canEditTopic = topic && getCanManageTopic(chat, topic);
return {