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(conference): notify moderators when settings could not be loaded

Дамян Минковf86db16374f6
diff --git a/lang/main.json b/lang/main.json
index bd099f775d..7b92f36e7d 100644
--- a/lang/main.json
+++ b/lang/main.json
@@ -985,6 +985,8 @@
"screenSharingAudioOnlyDescription": "Please note that by sharing your screen you're affecting the \"Best performance\" mode and you will use more bandwidth.",
"screenSharingAudioOnlyTitle": "\"Best performance\" mode",
"selfViewTitle": "You can always un-hide the self-view from settings",
+ "settingsIncompleteDescription": "Some meeting settings could not be loaded and default values were used instead.",
+ "settingsIncompleteTitle": "Meeting settings may be incomplete",
"somebody": "Somebody",
"startSilentDescription": "Rejoin the meeting to enable audio",
"startSilentTitle": "You joined with no audio output!",
diff --git a/react/features/base/conference/middleware.any.ts b/react/features/base/conference/middleware.any.ts
index bd7621c8c5..73bf47b62c 100644
--- a/react/features/base/conference/middleware.any.ts
+++ b/react/features/base/conference/middleware.any.ts
@@ -18,7 +18,12 @@ import { isTokenAuthEnabled } from '../../authentication/functions.any';
import { removeLobbyChatParticipant } from '../../chat/actions.any';
import { openDisplayNamePrompt } from '../../display-name/actions';
import { isVpaasMeeting } from '../../jaas/functions';
-import { clearNotifications, showErrorNotification, showNotification } from '../../notifications/actions';
+import {
+ clearNotifications,
+ showErrorNotification,
+ showNotification,
+ showWarningNotification
+} from '../../notifications/actions';
import { NOTIFICATION_TIMEOUT_TYPE } from '../../notifications/constants';
import { INotificationProps } from '../../notifications/types';
import { hasDisplayName } from '../../prejoin/utils';
@@ -34,12 +39,13 @@ import { validateJwt } from '../jwt/functions';
import { JitsiConferenceErrors, JitsiConferenceEvents, JitsiConnectionErrors } from '../lib-jitsi-meet';
import { loadConfig } from '../lib-jitsi-meet/functions';
import { MEDIA_TYPE } from '../media/constants';
-import { PARTICIPANT_UPDATED, PIN_PARTICIPANT } from '../participants/actionTypes';
+import { PARTICIPANT_ROLE_CHANGED, PARTICIPANT_UPDATED, PIN_PARTICIPANT } from '../participants/actionTypes';
import { PARTICIPANT_ROLE } from '../participants/constants';
import {
getLocalParticipant,
getParticipantById,
- getPinnedParticipant
+ getPinnedParticipant,
+ isLocalParticipantModerator
} from '../participants/functions';
import MiddlewareRegistry from '../redux/MiddlewareRegistry';
import StateListenerRegistry from '../redux/StateListenerRegistry';
@@ -56,7 +62,8 @@ import {
SEND_TONES,
SET_ASSUMED_BANDWIDTH_BPS,
SET_PENDING_SUBJECT_CHANGE,
- SET_ROOM
+ SET_ROOM,
+ UPDATE_CONFERENCE_METADATA
} from './actionTypes';
import {
authStatusChanged,
@@ -88,6 +95,11 @@ let beforeUnloadHandler: ((e?: any) => void) | undefined;
*/
let retryAsVisitorOnMaxError = true;
+/**
+ * A simple flag to avoid showing the "settings incomplete" notification more than once per conference.
+ */
+let settingsIncompleteNotificationShown = false;
+
/**
* Implements the middleware of the feature base/conference.
*
@@ -123,6 +135,9 @@ MiddlewareRegistry.register(store => next => action => {
case P2P_STATUS_CHANGED:
return _p2pStatusChanged(next, action);
+ case PARTICIPANT_ROLE_CHANGED:
+ return _participantRoleChanged(store, next, action);
+
case PARTICIPANT_UPDATED:
return _updateLocalParticipantInConference(store, next, action);
@@ -141,6 +156,9 @@ MiddlewareRegistry.register(store => next => action => {
case SET_ASSUMED_BANDWIDTH_BPS:
return _setAssumedBandwidthBps(store, next, action);
+
+ case UPDATE_CONFERENCE_METADATA:
+ return _conferenceMetadataUpdated(store, next, action);
}
return next(action);
@@ -378,6 +396,7 @@ function _conferenceJoined({ dispatch, getState }: IStore, next: Function, actio
} = getState()['features/base/config'];
retryAsVisitorOnMaxError = true;
+ settingsIncompleteNotificationShown = false;
dispatch(removeLobbyChatParticipant(true));
@@ -415,9 +434,96 @@ function _conferenceJoined({ dispatch, getState }: IStore, next: Function, actio
}));
}
+ _maybeNotifySettingsIncomplete({ dispatch, getState });
+
return result;
}
+/**
+ * Notifies the feature base/conference that the action {@code PARTICIPANT_ROLE_CHANGED} is being
+ * dispatched within a specific redux store. Used to re-check whether the "settings incomplete"
+ * notification should be shown, in case the local participant's moderator role is confirmed after
+ * the conference was already joined and the metadata already received.
+ *
+ * @param {Store} store - The redux store in which the specified {@code action} is being dispatched.
+ * @param {Dispatch} next - The redux {@code dispatch} function to dispatch the specified
+ * {@code action} to the specified {@code store}.
+ * @param {Action} action - The redux action {@code PARTICIPANT_ROLE_CHANGED} which is being
+ * dispatched in the specified {@code store}.
+ * @private
+ * @returns {Object} The value returned by {@code next(action)}.
+ */
+function _participantRoleChanged(store: IStore, next: Function, action: AnyAction) {
+ const result = next(action);
+ const { dispatch, getState } = store;
+
+ if (action.participant?.id === getLocalParticipant(getState)?.id) {
+ _maybeNotifySettingsIncomplete({ dispatch, getState });
+ }
+
+ return result;
+}
+
+/**
+ * Notifies the feature base/conference that the action {@code UPDATE_CONFERENCE_METADATA} is being
+ * dispatched within a specific redux store. Used to re-check whether the "settings incomplete"
+ * notification should be shown, in case the metadata arrives after the conference was already
+ * joined and the local participant's moderator role already known.
+ *
+ * @param {Store} store - The redux store in which the specified {@code action} is being dispatched.
+ * @param {Dispatch} next - The redux {@code dispatch} function to dispatch the specified
+ * {@code action} to the specified {@code store}.
+ * @param {Action} action - The redux action {@code UPDATE_CONFERENCE_METADATA} which is being
+ * dispatched in the specified {@code store}.
+ * @private
+ * @returns {Object} The value returned by {@code next(action)}.
+ */
+function _conferenceMetadataUpdated(store: IStore, next: Function, action: AnyAction) {
+ const result = next(action);
+
+ _maybeNotifySettingsIncomplete(store);
+
+ return result;
+}
+
+/**
+ * Shows a one-time warning notification to a moderator when the settings service applied
+ * hardcoded defaults (e.g. for the lobby) because it could not retrieve the real meeting
+ * settings in time. Only fires once conference join, the metadata, and the local participant's
+ * moderator role are all known - whichever of those three arrives last triggers it. Non-moderators
+ * never see it, since they cannot act on it.
+ *
+ * @param {Store} store - The redux store.
+ * @private
+ * @returns {void}
+ */
+function _maybeNotifySettingsIncomplete({ dispatch, getState }: IStore) {
+ if (settingsIncompleteNotificationShown) {
+ return;
+ }
+
+ const state = getState();
+
+ if (!getCurrentConference(state)) {
+ return;
+ }
+
+ if (!state['features/base/conference'].metadata?.settingsIncomplete) {
+ return;
+ }
+
+ if (!isLocalParticipantModerator(state)) {
+ return;
+ }
+
+ settingsIncompleteNotificationShown = true;
+
+ dispatch(showWarningNotification({
+ descriptionKey: 'notify.settingsIncompleteDescription',
+ titleKey: 'notify.settingsIncompleteTitle'
+ }, NOTIFICATION_TIMEOUT_TYPE.STICKY));
+}
+
/**
* Notifies the feature base/conference that the action
* {@code CONNECTION_ESTABLISHED} is being dispatched within a specific redux
diff --git a/react/features/base/conference/reducer.ts b/react/features/base/conference/reducer.ts
index c877cd9285..f2c9b60fe1 100644
--- a/react/features/base/conference/reducer.ts
+++ b/react/features/base/conference/reducer.ts
@@ -89,6 +89,13 @@ export interface IConferenceMetadata {
isRecordingRequested?: boolean;
isTranscribingEnabled: boolean;
};
+
+ /**
+ * Set by the settings service (via prosody) when it fell back to hardcoded defaults because
+ * one of its own upstream calls failed or timed out - meaning the settings applied to this
+ * room (e.g. lobby) may not reflect what was actually configured.
+ */
+ settingsIncomplete?: boolean;
visitors?: {
live: boolean;
};