From e756ce15489d56cd2f3aaa360093a92d3cf6b77d Mon Sep 17 00:00:00 2001
From: Anton Georgiev <anto.georgiev@gmail.com>
Date: Wed, 29 Aug 2018 16:00:53 +0000
Subject: [PATCH] comply to lock settings for chat

---
 bigbluebutton-html5/imports/ui/components/chat/service.js | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/bigbluebutton-html5/imports/ui/components/chat/service.js b/bigbluebutton-html5/imports/ui/components/chat/service.js
index 085e0c2eec..45c14b844c 100755
--- a/bigbluebutton-html5/imports/ui/components/chat/service.js
+++ b/bigbluebutton-html5/imports/ui/components/chat/service.js
@@ -105,15 +105,15 @@ const isChatLocked = (receiverID) => {
   const isPublic = receiverID === PUBLIC_CHAT_ID;
 
   const meeting = Meetings.findOne({});
-  const user = Users.findOne({});
+  const user = Users.findOne({ userId: Auth.userID });
 
   if (meeting.lockSettingsProp !== undefined) {
     const isPubChatLocked = meeting.lockSettingsProp.disablePubChat;
     const isPrivChatLocked = meeting.lockSettingsProp.disablePrivChat;
     const isViewer = user.role === 'VIEWER';
 
-    return (isPublic && isPubChatLocked && isViewer && user.locked)
-      || (!isPublic && isPrivChatLocked && isViewer && user.locked);
+    return isViewer && user.locked &&
+      ((isPublic && isPubChatLocked) || (!isPublic && isPrivChatLocked));
   }
 
   return false;
-- 
GitLab