소스 검색

fix(conference.js): Add message listeners only when chat is enabled

j8
yanas 8 년 전
부모
커밋
984085ac54
1개의 변경된 파일22개의 추가작업 그리고 15개의 파일을 삭제
  1. 22
    15
      conference.js

+ 22
- 15
conference.js 파일 보기

@@ -72,7 +72,10 @@ import {
72 72
     mediaPermissionPromptVisibilityChanged,
73 73
     suspendDetected
74 74
 } from './react/features/overlay';
75
-import { showDesktopSharingButton } from './react/features/toolbox';
75
+import {
76
+    isButtonEnabled,
77
+    showDesktopSharingButton
78
+} from './react/features/toolbox';
76 79
 
77 80
 const { participantConnectionStatus } = JitsiMeetJS.constants;
78 81
 
@@ -366,7 +369,8 @@ class ConferenceConnector {
366 369
         logger.error('CONFERENCE Error:', err, params);
367 370
         switch (err) {
368 371
         case ConferenceErrors.CHAT_ERROR:
369
-            {
372
+            logger.error("Chat error.", err);
373
+            if (isButtonEnabled('chat')) {
370 374
                 let [code, msg] = params;
371 375
                 APP.UI.showChatError(code, msg);
372 376
             }
@@ -1737,20 +1741,23 @@ export default {
1737 1741
             room.on(ConferenceEvents.CONNECTION_RESTORED, () => {
1738 1742
                 APP.UI.markVideoInterrupted(false);
1739 1743
             });
1740
-            room.on(ConferenceEvents.MESSAGE_RECEIVED, (id, body, ts) => {
1741
-                let nick = getDisplayName(id);
1742
-                APP.API.notifyReceivedChatMessage({
1743
-                    id,
1744
-                    nick,
1745
-                    body,
1746
-                    ts
1744
+
1745
+            if (isButtonEnabled('chat')) {
1746
+                room.on(ConferenceEvents.MESSAGE_RECEIVED, (id, body, ts) => {
1747
+                    let nick = getDisplayName(id);
1748
+                    APP.API.notifyReceivedChatMessage({
1749
+                        id,
1750
+                        nick,
1751
+                        body,
1752
+                        ts
1753
+                    });
1754
+                    APP.UI.addMessage(id, nick, body, ts);
1747 1755
                 });
1748
-                APP.UI.addMessage(id, nick, body, ts);
1749
-            });
1750
-            APP.UI.addListener(UIEvents.MESSAGE_CREATED, (message) => {
1751
-                APP.API.notifySendingChatMessage(message);
1752
-                room.sendTextMessage(message);
1753
-            });
1756
+                APP.UI.addListener(UIEvents.MESSAGE_CREATED, (message) => {
1757
+                    APP.API.notifySendingChatMessage(message);
1758
+                    room.sendTextMessage(message);
1759
+                });
1760
+            }
1754 1761
 
1755 1762
             APP.UI.addListener(UIEvents.SELECTED_ENDPOINT, (id) => {
1756 1763
                 try {

Loading…
취소
저장