Add config options for presence & join/leave message visibility

This commit is contained in:
Vlad Piersec 2020-01-14 11:41:16 +02:00 committed by Saúl Ibarra Corretgé
parent 45aafe5432
commit ad68a87dba
6 changed files with 52 additions and 17 deletions

View File

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

View File

@ -18,6 +18,8 @@ export default [
'CONNECTION_INDICATOR_AUTO_HIDE_TIMEOUT',
'CONNECTION_INDICATOR_DISABLED',
'DEFAULT_BACKGROUND',
'DISABLE_PRESENCE_STATUS',
'DISABLE_JOIN_LEAVE_NOTIFICATIONS',
'DEFAULT_LOCAL_DISPLAY_NAME',
'DEFAULT_REMOTE_DISPLAY_NAME',
'DISABLE_DOMINANT_SPEAKER_INDICATOR',

View File

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

View File

@ -15,6 +15,7 @@ import {
showParticipantJoinedNotification
} from './actions';
import { NOTIFICATION_TIMEOUT } from './constants';
import { joinLeaveNotificationsDisabled } from './functions';
declare var interfaceConfig: Object;
@ -31,7 +32,7 @@ MiddlewareRegistry.register(store => next => action => {
const { participant: p } = action;
if (!p.local) {
if (!p.local && !joinLeaveNotificationsDisabled()) {
store.dispatch(showParticipantJoinedNotification(
getParticipantDisplayName(store.getState, p.id)
));
@ -40,6 +41,7 @@ MiddlewareRegistry.register(store => next => action => {
return result;
}
case PARTICIPANT_LEFT: {
if (!joinLeaveNotificationsDisabled()) {
const participant = getParticipantById(
store.getState(),
action.participant.id
@ -52,8 +54,8 @@ MiddlewareRegistry.register(store => next => action => {
descriptionKey: 'notify.disconnected',
titleKey: 'notify.somebody',
title: participant.name
},
NOTIFICATION_TIMEOUT));
}, NOTIFICATION_TIMEOUT));
}
}
return next(action);

View File

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

View File

@ -0,0 +1,12 @@
// @flow
declare var interfaceConfig: Object;
/**
* Tells wether presence status should be displayed.
*
* @returns {boolean}
*/
export function presenceStatusDisabled() {
return Boolean(interfaceConfig?.DISABLE_PRESENCE_STATUS);
}