Merge pull request #18811 from Scroody/fix-locked-mods

Fix: Mods being locked
This commit is contained in:
Ramón Souza 2023-09-21 16:29:04 -03:00 committed by GitHub
commit 9ab231a977
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -15,6 +15,7 @@ import { checkText } from 'smile2emoji';
import deviceInfo from '/imports/utils/deviceInfo';
import { usePreviousValue } from '/imports/ui/components/utils/hooks';
import useChat from '/imports/ui/core/hooks/useChat';
import useCurrentUser from '/imports/ui/core/hooks/useCurrentUser';
import {
handleSendMessage,
startUserTyping,
@ -357,6 +358,11 @@ const ChatMessageFormContainer: React.FC = ({
public: c?.public,
}), idChatOpen) as Partial<Chat>;
const currentUser = useCurrentUser((c) => ({
isModerator: c?.isModerator,
locked: c?.locked,
}));
const title = chat?.participant?.name
? intl.formatMessage(messages.titlePrivate, { 0: chat?.participant?.name })
: intl.formatMessage(messages.titlePublic);
@ -365,9 +371,21 @@ const ChatMessageFormContainer: React.FC = ({
lockSettings: m?.lockSettings,
}));
const locked = chat?.public
? meeting?.lockSettings?.disablePublicChat
: meeting?.lockSettings?.disablePrivateChat;
const isModerator = currentUser?.isModerator;
const isPublicChat = chat?.public;
const isLocked = currentUser?.locked;
const disablePublicChat = meeting?.lockSettings?.disablePublicChat;
const disablePrivateChat = meeting?.lockSettings?.disablePrivateChat;
let locked = false;
if (!isModerator) {
if (isPublicChat) {
locked = (isLocked && disablePublicChat) || false;
} else {
locked = (isLocked && disablePrivateChat) || false;
}
}
const handleClickOutside = () => {
if (showEmojiPicker) {