Browse Source

Add config options for presence & join/leave message visibility

master
Vlad Piersec 4 years ago
parent
commit
ad68a87dba

+ 7
- 1
interface_config.js View File

@@ -193,7 +193,13 @@ var interfaceConfig = {
193 193
     /**
194 194
      * If we should capture periodic screenshots of the content sharing.
195 195
      */
196
-    ENABLE_SCREENSHOT_CAPTURE: false
196
+    ENABLE_SCREENSHOT_CAPTURE: false,
197
+
198
+    // If true, presence status: busy, calling, connected etc. is not displayed
199
+    DISABLE_PRESENCE_STATUS: false,
200
+
201
+    // If true, notifications regarding joining/leaving are no longer displayed
202
+    DISABLE_JOIN_LEAVE_NOTIFICATIONS: false
197 203
 
198 204
     /**
199 205
      * How many columns the tile view can expand to. The respected range is

+ 2
- 0
react/features/base/config/interfaceConfigWhitelist.js View File

@@ -18,6 +18,8 @@ export default [
18 18
     'CONNECTION_INDICATOR_AUTO_HIDE_TIMEOUT',
19 19
     'CONNECTION_INDICATOR_DISABLED',
20 20
     'DEFAULT_BACKGROUND',
21
+    'DISABLE_PRESENCE_STATUS',
22
+    'DISABLE_JOIN_LEAVE_NOTIFICATIONS',
21 23
     'DEFAULT_LOCAL_DISPLAY_NAME',
22 24
     'DEFAULT_REMOTE_DISPLAY_NAME',
23 25
     'DISABLE_DOMINANT_SPEAKER_INDICATOR',

+ 11
- 0
react/features/notifications/functions.js View File

@@ -2,6 +2,8 @@
2 2
 
3 3
 import { toState } from '../base/redux';
4 4
 
5
+declare var interfaceConfig: Object;
6
+
5 7
 /**
6 8
  * Tells whether or not the notifications are enabled and if there are any
7 9
  * notifications to be displayed based on the current Redux state.
@@ -15,3 +17,12 @@ export function areThereNotifications(stateful: Object | Function) {
15 17
 
16 18
     return enabled && notifications.length > 0;
17 19
 }
20
+
21
+/**
22
+ * Tells wether join/leave notifications are enabled in interface_config.
23
+ *
24
+ * @returns {boolean}
25
+ */
26
+export function joinLeaveNotificationsDisabled() {
27
+    return Boolean(interfaceConfig?.DISABLE_JOIN_LEAVE_NOTIFICATIONS);
28
+}

+ 16
- 14
react/features/notifications/middleware.js View File

@@ -15,6 +15,7 @@ import {
15 15
     showParticipantJoinedNotification
16 16
 } from './actions';
17 17
 import { NOTIFICATION_TIMEOUT } from './constants';
18
+import { joinLeaveNotificationsDisabled } from './functions';
18 19
 
19 20
 declare var interfaceConfig: Object;
20 21
 
@@ -31,7 +32,7 @@ MiddlewareRegistry.register(store => next => action => {
31 32
 
32 33
         const { participant: p } = action;
33 34
 
34
-        if (!p.local) {
35
+        if (!p.local && !joinLeaveNotificationsDisabled()) {
35 36
             store.dispatch(showParticipantJoinedNotification(
36 37
                 getParticipantDisplayName(store.getState, p.id)
37 38
             ));
@@ -40,20 +41,21 @@ MiddlewareRegistry.register(store => next => action => {
40 41
         return result;
41 42
     }
42 43
     case PARTICIPANT_LEFT: {
43
-        const participant = getParticipantById(
44
-            store.getState(),
45
-            action.participant.id
46
-        );
44
+        if (!joinLeaveNotificationsDisabled()) {
45
+            const participant = getParticipantById(
46
+                store.getState(),
47
+                action.participant.id
48
+            );
47 49
 
48
-        if (typeof interfaceConfig === 'object'
49
-            && participant
50
-            && !participant.local) {
51
-            store.dispatch(showNotification({
52
-                descriptionKey: 'notify.disconnected',
53
-                titleKey: 'notify.somebody',
54
-                title: participant.name
55
-            },
56
-            NOTIFICATION_TIMEOUT));
50
+            if (typeof interfaceConfig === 'object'
51
+                && participant
52
+                && !participant.local) {
53
+                store.dispatch(showNotification({
54
+                    descriptionKey: 'notify.disconnected',
55
+                    titleKey: 'notify.somebody',
56
+                    title: participant.name
57
+                }, NOTIFICATION_TIMEOUT));
58
+            }
57 59
         }
58 60
 
59 61
         return next(action);

+ 4
- 2
react/features/presence-status/components/PresenceLabel.js View File

@@ -8,6 +8,7 @@ import { Text } from '../../base/react';
8 8
 import { connect } from '../../base/redux';
9 9
 
10 10
 import { STATUS_TO_I18N_KEY } from '../constants';
11
+import { presenceStatusDisabled } from '../functions';
11 12
 
12 13
 /**
13 14
  * The type of the React {@code Component} props of {@link PresenceLabel}.
@@ -124,8 +125,9 @@ function _mapStateToProps(state, ownProps) {
124 125
     const participant = getParticipantById(state, ownProps.participantID);
125 126
 
126 127
     return {
127
-        _presence:
128
-            (participant && participant.presence) || ownProps.defaultPresence
128
+        _presence: presenceStatusDisabled() ? ''
129
+            : participant?.presence || ownProps.defaultPresence
130
+
129 131
     };
130 132
 }
131 133
 

+ 12
- 0
react/features/presence-status/functions.js View File

@@ -0,0 +1,12 @@
1
+// @flow
2
+
3
+declare var interfaceConfig: Object;
4
+
5
+/**
6
+ * Tells wether presence status should be displayed.
7
+ *
8
+ * @returns {boolean}
9
+ */
10
+export function presenceStatusDisabled() {
11
+    return Boolean(interfaceConfig?.DISABLE_PRESENCE_STATUS);
12
+}

Loading…
Cancel
Save