Forum: Fix topic creation permission check (#2322)
This commit is contained in:
parent
c702f65148
commit
2d23ec775e
@ -29,6 +29,7 @@ import {
|
|||||||
isChatGroup,
|
isChatGroup,
|
||||||
getCanManageTopic,
|
getCanManageTopic,
|
||||||
isUserRightBanned,
|
isUserRightBanned,
|
||||||
|
getHasAdminRight,
|
||||||
} from '../../global/helpers';
|
} from '../../global/helpers';
|
||||||
import useShowTransition from '../../hooks/useShowTransition';
|
import useShowTransition from '../../hooks/useShowTransition';
|
||||||
import usePrevDuringAnimation from '../../hooks/usePrevDuringAnimation';
|
import usePrevDuringAnimation from '../../hooks/usePrevDuringAnimation';
|
||||||
@ -554,7 +555,9 @@ export default memo(withGlobal<OwnProps>(
|
|||||||
);
|
);
|
||||||
|
|
||||||
const topic = chat?.topics?.[threadId];
|
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);
|
const canEditTopic = topic && getCanManageTopic(chat, topic);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user