Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

feat(notifications) skip join notifications when meetings grow large

Saúl Ibarra Corretgé9a8b67a0a46a
diff --git a/react/features/notifications/actions.js b/react/features/notifications/actions.js
index cc40768c33..a202e03794 100644
--- a/react/features/notifications/actions.js
+++ b/react/features/notifications/actions.js
@@ -4,6 +4,7 @@ import throttle from 'lodash/throttle';
import type { Dispatch } from 'redux';
import { NOTIFICATIONS_ENABLED, getFeatureFlag } from '../base/flags';
+import { getParticipantCount } from '../base/participants/functions';
import {
CLEAR_NOTIFICATIONS,
@@ -11,7 +12,11 @@ import {
SET_NOTIFICATIONS_ENABLED,
SHOW_NOTIFICATION
} from './actionTypes';
-import { NOTIFICATION_TIMEOUT, NOTIFICATION_TYPE } from './constants';
+import {
+ NOTIFICATION_TIMEOUT,
+ NOTIFICATION_TYPE,
+ SILENT_JOIN_THRESHOLD
+} from './constants';
/**
* Clears (removes) all the notifications.
@@ -133,7 +138,16 @@ let joinedParticipantsNames = [];
* @private
* @type {Function}
*/
-const _throttledNotifyParticipantConnected = throttle((dispatch: Dispatch<any>) => {
+const _throttledNotifyParticipantConnected = throttle((dispatch: Dispatch<any>, getState: Function) => {
+ const participantCount = getParticipantCount(getState());
+
+ // Skip join notifications altogether for large meetings.
+ if (participantCount > SILENT_JOIN_THRESHOLD) {
+ joinedParticipantsNames = [];
+
+ return;
+ }
+
const joinedParticipantsCount = joinedParticipantsNames.length;
let notificationProps;
@@ -182,5 +196,5 @@ const _throttledNotifyParticipantConnected = throttle((dispatch: Dispatch<any>)
export function showParticipantJoinedNotification(displayName: string) {
joinedParticipantsNames.push(displayName);
- return (dispatch: Dispatch<any>) => _throttledNotifyParticipantConnected(dispatch);
+ return (dispatch: Dispatch<any>, getState: Function) => _throttledNotifyParticipantConnected(dispatch, getState);
}
diff --git a/react/features/notifications/constants.js b/react/features/notifications/constants.js
index 643871a6b3..73213206da 100644
--- a/react/features/notifications/constants.js
+++ b/react/features/notifications/constants.js
@@ -30,3 +30,8 @@ export const NOTIFICATION_TYPE_PRIORITIES = {
[NOTIFICATION_TYPE.SUCCESS]: 3,
[NOTIFICATION_TYPE.WARNING]: 4
};
+
+/**
+ * Amount of participants beyond which no join notification will be emitted.
+ */
+export const SILENT_JOIN_THRESHOLD = 30;