浏览代码

fix(toolbox) fix displaying mute everyone buttons for non-moderators

j8
Saúl Ibarra Corretgé 4 年前
父节点
当前提交
47c9e14155

+ 3
- 10
react/features/toolbox/components/MuteEveryoneButton.js 查看文件

@@ -4,7 +4,7 @@ import { createToolbarEvent, sendAnalytics } from '../../analytics';
4 4
 import { openDialog } from '../../base/dialog';
5 5
 import { translate } from '../../base/i18n';
6 6
 import { IconMuteEveryone } from '../../base/icons';
7
-import { getLocalParticipant, PARTICIPANT_ROLE } from '../../base/participants';
7
+import { getLocalParticipant, isLocalParticipantModerator } from '../../base/participants';
8 8
 import { connect } from '../../base/redux';
9 9
 import { AbstractButton, type AbstractButtonProps } from '../../base/toolbox/components';
10 10
 import { MuteEveryoneDialog } from '../../video-menu/components';
@@ -16,11 +16,6 @@ type Props = AbstractButtonProps & {
16 16
      */
17 17
     dispatch: Function,
18 18
 
19
-    /*
20
-     ** Whether the local participant is a moderator or not.
21
-     */
22
-    isModerator: Boolean,
23
-
24 19
     /**
25 20
      * The ID of the local participant.
26 21
      */
@@ -61,14 +56,12 @@ class MuteEveryoneButton extends AbstractButton<Props, *> {
61 56
  */
62 57
 function _mapStateToProps(state: Object, ownProps: Props) {
63 58
     const localParticipant = getLocalParticipant(state);
64
-    const isModerator = localParticipant.role === PARTICIPANT_ROLE.MODERATOR;
65
-    const { visible } = ownProps;
66 59
     const { disableRemoteMute } = state['features/base/config'];
60
+    const { visible = isLocalParticipantModerator(state) && !disableRemoteMute } = ownProps;
67 61
 
68 62
     return {
69
-        isModerator,
70 63
         localParticipantId: localParticipant.id,
71
-        visible: visible && isModerator && !disableRemoteMute
64
+        visible
72 65
     };
73 66
 }
74 67
 

+ 3
- 10
react/features/toolbox/components/MuteEveryonesVideoButton.js 查看文件

@@ -4,7 +4,7 @@ import { createToolbarEvent, sendAnalytics } from '../../analytics';
4 4
 import { openDialog } from '../../base/dialog';
5 5
 import { translate } from '../../base/i18n';
6 6
 import { IconMuteVideoEveryone } from '../../base/icons';
7
-import { getLocalParticipant, PARTICIPANT_ROLE } from '../../base/participants';
7
+import { getLocalParticipant, isLocalParticipantModerator } from '../../base/participants';
8 8
 import { connect } from '../../base/redux';
9 9
 import { AbstractButton, type AbstractButtonProps } from '../../base/toolbox/components';
10 10
 import { MuteEveryonesVideoDialog } from '../../video-menu/components';
@@ -16,11 +16,6 @@ type Props = AbstractButtonProps & {
16 16
      */
17 17
     dispatch: Function,
18 18
 
19
-    /*
20
-     ** Whether the local participant is a moderator or not.
21
-     */
22
-    isModerator: Boolean,
23
-
24 19
     /**
25 20
      * The ID of the local participant.
26 21
      */
@@ -61,14 +56,12 @@ class MuteEveryonesVideoButton extends AbstractButton<Props, *> {
61 56
  */
62 57
 function _mapStateToProps(state: Object, ownProps: Props) {
63 58
     const localParticipant = getLocalParticipant(state);
64
-    const isModerator = localParticipant.role === PARTICIPANT_ROLE.MODERATOR;
65
-    const { visible } = ownProps;
66 59
     const { disableRemoteMute } = state['features/base/config'];
60
+    const { visible = isLocalParticipantModerator(state) && !disableRemoteMute } = ownProps;
67 61
 
68 62
     return {
69
-        isModerator,
70 63
         localParticipantId: localParticipant.id,
71
-        visible: visible && isModerator && !disableRemoteMute
64
+        visible
72 65
     };
73 66
 }
74 67
 

正在加载...
取消
保存