|
@@ -4,6 +4,7 @@ import throttle from 'lodash/throttle';
|
4
|
4
|
import type { Dispatch } from 'redux';
|
5
|
5
|
|
6
|
6
|
import { NOTIFICATIONS_ENABLED, getFeatureFlag } from '../base/flags';
|
|
7
|
+import { getParticipantCount } from '../base/participants/functions';
|
7
|
8
|
|
8
|
9
|
import {
|
9
|
10
|
CLEAR_NOTIFICATIONS,
|
|
@@ -11,7 +12,11 @@ import {
|
11
|
12
|
SET_NOTIFICATIONS_ENABLED,
|
12
|
13
|
SHOW_NOTIFICATION
|
13
|
14
|
} from './actionTypes';
|
14
|
|
-import { NOTIFICATION_TIMEOUT, NOTIFICATION_TYPE } from './constants';
|
|
15
|
+import {
|
|
16
|
+ NOTIFICATION_TIMEOUT,
|
|
17
|
+ NOTIFICATION_TYPE,
|
|
18
|
+ SILENT_JOIN_THRESHOLD
|
|
19
|
+} from './constants';
|
15
|
20
|
|
16
|
21
|
/**
|
17
|
22
|
* Clears (removes) all the notifications.
|
|
@@ -133,7 +138,16 @@ let joinedParticipantsNames = [];
|
133
|
138
|
* @private
|
134
|
139
|
* @type {Function}
|
135
|
140
|
*/
|
136
|
|
-const _throttledNotifyParticipantConnected = throttle((dispatch: Dispatch<any>) => {
|
|
141
|
+const _throttledNotifyParticipantConnected = throttle((dispatch: Dispatch<any>, getState: Function) => {
|
|
142
|
+ const participantCount = getParticipantCount(getState());
|
|
143
|
+
|
|
144
|
+ // Skip join notifications altogether for large meetings.
|
|
145
|
+ if (participantCount > SILENT_JOIN_THRESHOLD) {
|
|
146
|
+ joinedParticipantsNames = [];
|
|
147
|
+
|
|
148
|
+ return;
|
|
149
|
+ }
|
|
150
|
+
|
137
|
151
|
const joinedParticipantsCount = joinedParticipantsNames.length;
|
138
|
152
|
|
139
|
153
|
let notificationProps;
|
|
@@ -182,5 +196,5 @@ const _throttledNotifyParticipantConnected = throttle((dispatch: Dispatch<any>)
|
182
|
196
|
export function showParticipantJoinedNotification(displayName: string) {
|
183
|
197
|
joinedParticipantsNames.push(displayName);
|
184
|
198
|
|
185
|
|
- return (dispatch: Dispatch<any>) => _throttledNotifyParticipantConnected(dispatch);
|
|
199
|
+ return (dispatch: Dispatch<any>, getState: Function) => _throttledNotifyParticipantConnected(dispatch, getState);
|
186
|
200
|
}
|