Browse Source

fix(config, reactions) Added config option to disable reaction sounds (#10046)

master
robertpin 4 years ago
parent
commit
31ce7e010d
No account linked to committer's email address

+ 1
- 0
config.js View File

772
     // - 'PARTICIPANT_JOINED_SOUND'
772
     // - 'PARTICIPANT_JOINED_SOUND'
773
     // - 'PARTICIPANT_LEFT_SOUND'
773
     // - 'PARTICIPANT_LEFT_SOUND'
774
     // - 'RAISE_HAND_SOUND'
774
     // - 'RAISE_HAND_SOUND'
775
+    // - 'REACTION_SOUND'
775
     // - 'RECORDING_OFF_SOUND'
776
     // - 'RECORDING_OFF_SOUND'
776
     // - 'RECORDING_ON_SOUND'
777
     // - 'RECORDING_ON_SOUND'
777
     // - 'TALK_WHILE_MUTED_SOUND'
778
     // - 'TALK_WHILE_MUTED_SOUND'

+ 1
- 1
react/features/base/sounds/actions.js View File

70
     return (dispatch: Function, getState: Function) => {
70
     return (dispatch: Function, getState: Function) => {
71
         const disabledSounds = getDisabledSounds(getState());
71
         const disabledSounds = getDisabledSounds(getState());
72
 
72
 
73
-        if (!disabledSounds.includes(soundId)) {
73
+        if (!disabledSounds.includes(soundId) && !disabledSounds.find(id => soundId.startsWith(id))) {
74
             dispatch({
74
             dispatch({
75
                 type: PLAY_SOUND,
75
                 type: PLAY_SOUND,
76
                 soundId
76
                 soundId

+ 11
- 6
react/features/reactions/constants.js View File

14
  */
14
  */
15
 export const ENDPOINT_REACTION_NAME = 'endpoint-reaction';
15
 export const ENDPOINT_REACTION_NAME = 'endpoint-reaction';
16
 
16
 
17
+/**
18
+ * The prefix for all reaction sound IDs. Also the ID used in config to disable reaction sounds.
19
+ */
20
+export const REACTION_SOUND = 'REACTION_SOUND';
21
+
17
 /**
22
 /**
18
  * The audio ID prefix of the audio element for which the {@link playAudio} action is
23
  * The audio ID prefix of the audio element for which the {@link playAudio} action is
19
  * triggered when a new laugh reaction is received.
24
  * triggered when a new laugh reaction is received.
20
  *
25
  *
21
  * @type { string }
26
  * @type { string }
22
  */
27
  */
23
-export const LAUGH_SOUND_ID = 'LAUGH_SOUND_';
28
+export const LAUGH_SOUND_ID = `${REACTION_SOUND}_LAUGH_`;
24
 
29
 
25
 /**
30
 /**
26
  * The audio ID prefix of the audio element for which the {@link playAudio} action is
31
  * The audio ID prefix of the audio element for which the {@link playAudio} action is
28
  *
33
  *
29
  * @type {string}
34
  * @type {string}
30
  */
35
  */
31
-export const CLAP_SOUND_ID = 'CLAP_SOUND_';
36
+export const CLAP_SOUND_ID = `${REACTION_SOUND}_CLAP_`;
32
 
37
 
33
 /**
38
 /**
34
  * The audio ID prefix of the audio element for which the {@link playAudio} action is
39
  * The audio ID prefix of the audio element for which the {@link playAudio} action is
36
  *
41
  *
37
  * @type {string}
42
  * @type {string}
38
  */
43
  */
39
-export const LIKE_SOUND_ID = 'LIKE_SOUND_';
44
+export const LIKE_SOUND_ID = `${REACTION_SOUND}_LIKE_`;
40
 
45
 
41
 /**
46
 /**
42
  * The audio ID prefix of the audio element for which the {@link playAudio} action is
47
  * The audio ID prefix of the audio element for which the {@link playAudio} action is
44
  *
49
  *
45
  * @type {string}
50
  * @type {string}
46
  */
51
  */
47
-export const BOO_SOUND_ID = 'BOO_SOUND_';
52
+export const BOO_SOUND_ID = `${REACTION_SOUND}_BOO_`;
48
 
53
 
49
 /**
54
 /**
50
  * The audio ID prefix of the audio element for which the {@link playAudio} action is
55
  * The audio ID prefix of the audio element for which the {@link playAudio} action is
52
  *
57
  *
53
  * @type {string}
58
  * @type {string}
54
  */
59
  */
55
-export const SURPRISE_SOUND_ID = 'SURPRISE_SOUND_';
60
+export const SURPRISE_SOUND_ID = `${REACTION_SOUND}_SURPRISE_`;
56
 
61
 
57
 /**
62
 /**
58
  * The audio ID prefix of the audio element for which the {@link playAudio} action is
63
  * The audio ID prefix of the audio element for which the {@link playAudio} action is
60
  *
65
  *
61
  * @type {string}
66
  * @type {string}
62
  */
67
  */
63
-export const SILENCE_SOUND_ID = 'SILENCE_SOUND_';
68
+export const SILENCE_SOUND_ID = `${REACTION_SOUND}_SILENCE_`;
64
 
69
 
65
 /**
70
 /**
66
  * The audio ID of the audio element for which the {@link playAudio} action is
71
  * The audio ID of the audio element for which the {@link playAudio} action is

+ 11
- 2
react/features/reactions/middleware.js View File

7
 import { MiddlewareRegistry } from '../base/redux';
7
 import { MiddlewareRegistry } from '../base/redux';
8
 import { updateSettings } from '../base/settings';
8
 import { updateSettings } from '../base/settings';
9
 import { playSound, registerSound, unregisterSound } from '../base/sounds';
9
 import { playSound, registerSound, unregisterSound } from '../base/sounds';
10
+import { getDisabledSounds } from '../base/sounds/functions.any';
10
 import { isVpaasMeeting } from '../jaas/functions';
11
 import { isVpaasMeeting } from '../jaas/functions';
11
 import { NOTIFICATION_TIMEOUT, showNotification } from '../notifications';
12
 import { NOTIFICATION_TIMEOUT, showNotification } from '../notifications';
12
 
13
 
25
     sendReactions,
26
     sendReactions,
26
     setReactionQueue
27
     setReactionQueue
27
 } from './actions.any';
28
 } from './actions.any';
28
-import { ENDPOINT_REACTION_NAME, RAISE_HAND_SOUND_ID, REACTIONS, SOUNDS_THRESHOLDS } from './constants';
29
+import {
30
+    ENDPOINT_REACTION_NAME,
31
+    RAISE_HAND_SOUND_ID,
32
+    REACTIONS,
33
+    REACTION_SOUND,
34
+    SOUNDS_THRESHOLDS
35
+} from './constants';
29
 import {
36
 import {
30
     getReactionMessageFromBuffer,
37
     getReactionMessageFromBuffer,
31
     getReactionsSoundsThresholds,
38
     getReactionsSoundsThresholds,
128
         const state = getState();
135
         const state = getState();
129
         const { queue, notificationDisplayed } = state['features/reactions'];
136
         const { queue, notificationDisplayed } = state['features/reactions'];
130
         const { soundsReactions } = state['features/base/settings'];
137
         const { soundsReactions } = state['features/base/settings'];
138
+        const disabledSounds = getDisabledSounds(state);
131
         const reactions = action.reactions;
139
         const reactions = action.reactions;
132
 
140
 
133
         batch(() => {
141
         batch(() => {
134
-            if (!notificationDisplayed && soundsReactions && displayReactionSoundsNotification) {
142
+            if (!notificationDisplayed && soundsReactions && !disabledSounds.includes(REACTION_SOUND)
143
+                && displayReactionSoundsNotification) {
135
                 dispatch(displayReactionSoundsNotification());
144
                 dispatch(displayReactionSoundsNotification());
136
             }
145
             }
137
             if (soundsReactions) {
146
             if (soundsReactions) {

Loading…
Cancel
Save