Selaa lähdekoodia

fix: Fixes disable moderation sounds in meeting. (#10604)

* fix: Fixes disable moderation sounds in meeting.

Moderators in the meeting were sending presence update after one moderator turn it on, which even my result a inconsistent state and flipping the state between moderators several times.

* squash: Adds option to disable reaction moderation.
master
Дамян Минков 3 vuotta sitten
vanhempi
commit
f620d101ba
No account linked to committer's email address

+ 3
- 0
config.js Näytä tiedosto

@@ -80,6 +80,9 @@ var config = {
80 80
     // Disables the reactions feature.
81 81
     // disableReactions: true,
82 82
 
83
+    // Disables the reactions moderation feature.
84
+    // disableReactionsModeration: false,
85
+
83 86
     // Disables polls feature.
84 87
     // disablePolls: false,
85 88
 

+ 4
- 2
react/features/base/conference/actions.js Näytä tiedosto

@@ -670,15 +670,17 @@ export function setFollowMe(enabled: boolean) {
670 670
  * Enables or disables the Mute reaction sounds feature.
671 671
  *
672 672
  * @param {boolean} muted - Whether or not reaction sounds should be muted for all participants.
673
+ * @param {boolean} updateBackend - Whether or not the moderator should notify all participants for the new setting.
673 674
  * @returns {{
674 675
  *     type: SET_START_REACTIONS_MUTED,
675 676
  *     muted: boolean
676 677
  * }}
677 678
  */
678
-export function setStartReactionsMuted(muted: boolean) {
679
+export function setStartReactionsMuted(muted: boolean, updateBackend: boolean = false) {
679 680
     return {
680 681
         type: SET_START_REACTIONS_MUTED,
681
-        muted
682
+        muted,
683
+        updateBackend
682 684
     };
683 685
 }
684 686
 

+ 1
- 0
react/features/base/config/configWhitelist.js Näytä tiedosto

@@ -108,6 +108,7 @@ export default [
108 108
     'disablePolls',
109 109
     'disableProfile',
110 110
     'disableReactions',
111
+    'disableReactionsModeration',
111 112
     'disableRecordAudioNotification',
112 113
     'disableRemoteControl',
113 114
     'disableRemoteMute',

+ 17
- 6
react/features/reactions/middleware.js Näytä tiedosto

@@ -4,7 +4,11 @@ import { batch } from 'react-redux';
4 4
 
5 5
 import { createReactionSoundsDisabledEvent, sendAnalytics } from '../analytics';
6 6
 import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../base/app';
7
-import { CONFERENCE_WILL_JOIN, setStartReactionsMuted } from '../base/conference';
7
+import {
8
+    CONFERENCE_WILL_JOIN,
9
+    SET_START_REACTIONS_MUTED,
10
+    setStartReactionsMuted
11
+} from '../base/conference';
8 12
 import {
9 13
     getParticipantById,
10 14
     getParticipantCount,
@@ -49,11 +53,6 @@ import {
49 53
 import logger from './logger';
50 54
 import { RAISE_HAND_SOUND_FILE } from './sounds';
51 55
 
52
-import './subscriber';
53
-
54
-
55
-declare var APP: Object;
56
-
57 56
 /**
58 57
  * Middleware which intercepts Reactions actions to handle changes to the
59 58
  * visibility timeout of the Reactions.
@@ -171,6 +170,18 @@ MiddlewareRegistry.register(store => next => action => {
171 170
         break;
172 171
     }
173 172
 
173
+    // Settings changed for mute reactions in the meeting
174
+    case SET_START_REACTIONS_MUTED: {
175
+        const state = getState();
176
+        const { conference } = state['features/base/conference'];
177
+        const { muted, updateBackend } = action;
178
+
179
+        if (conference && isLocalParticipantModerator(state) && updateBackend) {
180
+            conference.sendCommand(MUTE_REACTIONS_COMMAND, { attributes: { startReactionsMuted: Boolean(muted) } });
181
+        }
182
+        break;
183
+    }
184
+
174 185
     case SETTINGS_UPDATED: {
175 186
         const { soundsReactions } = getState()['features/base/settings'];
176 187
 

+ 0
- 45
react/features/reactions/subscriber.js Näytä tiedosto

@@ -1,45 +0,0 @@
1
-// @flow
2
-
3
-import { getCurrentConference } from '../base/conference';
4
-import { isLocalParticipantModerator } from '../base/participants';
5
-import { StateListenerRegistry } from '../base/redux';
6
-
7
-import { MUTE_REACTIONS_COMMAND } from './constants';
8
-
9
-/**
10
- * Subscribes to changes to the Mute Reaction Sounds setting for the local participant to
11
- * notify remote participants of current user interface status.
12
- * Changing newSelectedValue param to off, when feature is turned of so we can
13
- * notify all listeners.
14
- */
15
-StateListenerRegistry.register(
16
-    /* selector */ state => state['features/base/conference'].startReactionsMuted,
17
-    /* listener */ (newSelectedValue, store) => _sendMuteReactionsCommand(newSelectedValue || false, store));
18
-
19
-
20
-/**
21
- * Sends the mute-reactions command, when a local property change occurs.
22
- *
23
- * @param {*} newSelectedValue - The changed selected value from the selector.
24
- * @param {Object} store - The redux store.
25
- * @private
26
- * @returns {void}
27
- */
28
-function _sendMuteReactionsCommand(newSelectedValue, store) {
29
-    const state = store.getState();
30
-    const conference = getCurrentConference(state);
31
-
32
-    if (!conference) {
33
-        return;
34
-    }
35
-
36
-    // Only a moderator is allowed to send commands.
37
-    if (!isLocalParticipantModerator(state)) {
38
-        return;
39
-    }
40
-
41
-    conference.sendCommand(
42
-        MUTE_REACTIONS_COMMAND,
43
-        { attributes: { startReactionsMuted: Boolean(newSelectedValue) } }
44
-    );
45
-}

+ 2
- 1
react/features/settings/actions.js Näytä tiedosto

@@ -129,7 +129,8 @@ export function submitModeratorTab(newState: Object): Function {
129 129
 
130 130
         if (newState.startReactionsMuted !== currentState.startReactionsMuted) {
131 131
             batch(() => {
132
-                dispatch(setStartReactionsMuted(newState.startReactionsMuted));
132
+                // updating settings we want to update and backend (notify the rest of the participants)
133
+                dispatch(setStartReactionsMuted(newState.startReactionsMuted, true));
133 134
                 dispatch(updateSettings({ soundsReactions: !newState.startReactionsMuted }));
134 135
             });
135 136
         }

+ 12
- 5
react/features/settings/components/web/ModeratorTab.js Näytä tiedosto

@@ -12,6 +12,11 @@ import { translate } from '../../../base/i18n';
12 12
 export type Props = {
13 13
     ...$Exact<AbstractDialogTabProps>,
14 14
 
15
+    /**
16
+     *
17
+     */
18
+    disableReactionsModeration: boolean,
19
+
15 20
     /**
16 21
      * Whether or not follow me is currently active (enabled by some other participant).
17 22
      */
@@ -142,6 +147,7 @@ class ModeratorTab extends AbstractDialogTab<Props> {
142 147
      */
143 148
     _renderModeratorSettings() {
144 149
         const {
150
+            disableReactionsModeration,
145 151
             followMeActive,
146 152
             followMeEnabled,
147 153
             startAudioMuted,
@@ -171,11 +177,12 @@ class ModeratorTab extends AbstractDialogTab<Props> {
171 177
                         label = { t('settings.followMe') }
172 178
                         name = 'follow-me'
173 179
                         onChange = { this._onFollowMeEnabledChanged } />
174
-                    <Checkbox
175
-                        isChecked = { startReactionsMuted }
176
-                        label = { t('settings.startReactionsMuted') }
177
-                        name = 'start-reactions-muted'
178
-                        onChange = { this._onStartReactionsMutedChanged } />
180
+                    { !disableReactionsModeration
181
+                        && <Checkbox
182
+                            isChecked = { startReactionsMuted }
183
+                            label = { t('settings.startReactionsMuted') }
184
+                            name = 'start-reactions-muted'
185
+                            onChange = { this._onStartReactionsMutedChanged } /> }
179 186
                 </div>
180 187
             </div>
181 188
         );

+ 2
- 0
react/features/settings/functions.js Näytä tiedosto

@@ -120,6 +120,7 @@ export function getModeratorTabProps(stateful: Object | Function) {
120 120
         startVideoMutedPolicy,
121 121
         startReactionsMuted
122 122
     } = state['features/base/conference'];
123
+    const { disableReactionsModeration } = state['features/base/config'];
123 124
     const followMeActive = isFollowMeActive(state);
124 125
     const configuredTabs = interfaceConfig.SETTINGS_SECTIONS || [];
125 126
 
@@ -131,6 +132,7 @@ export function getModeratorTabProps(stateful: Object | Function) {
131 132
     // The settings sections to display.
132 133
     return {
133 134
         showModeratorSettings,
135
+        disableReactionsModeration: Boolean(disableReactionsModeration),
134 136
         followMeActive: Boolean(conference && followMeActive),
135 137
         followMeEnabled: Boolean(conference && followMeEnabled),
136 138
         startReactionsMuted: Boolean(conference && startReactionsMuted),

Loading…
Peruuta
Tallenna