feat: Add a new setting to remove individual sharing features from UI (#8660)

* Added new config to enable individual sharing features

* make config values url friendly

* Add new setting to whitelist

* Fixed some linter issues

* Fixed more linter issues

* Fixed merge error

* Check if interfaceConfig is defined

* Only show more numbers link if there is more than one number
This commit is contained in:
Steffen Kolmer
2021-02-27 02:50:26 +01:00
committed by GitHub
parent 7bbd06c9f4
commit 5d8bf0c1e7
7 changed files with 85 additions and 10 deletions

View File

@@ -168,6 +168,13 @@ var interfaceConfig = {
REMOTE_THUMBNAIL_RATIO: 1, // 1:1 REMOTE_THUMBNAIL_RATIO: 1, // 1:1
SETTINGS_SECTIONS: [ 'devices', 'language', 'moderator', 'profile', 'calendar' ], SETTINGS_SECTIONS: [ 'devices', 'language', 'moderator', 'profile', 'calendar' ],
/**
* Specify which sharing features should be displayed. If the value is not set
* all sharing features will be shown. You can set [] to disable all.
*/
// SHARING_FEATURES: ['email', 'url', 'dial-in', 'embed'],
SHOW_BRAND_WATERMARK: false, SHOW_BRAND_WATERMARK: false,
/** /**

View File

@@ -43,6 +43,7 @@ export default [
'RECENT_LIST_ENABLED', 'RECENT_LIST_ENABLED',
'REMOTE_THUMBNAIL_RATIO', 'REMOTE_THUMBNAIL_RATIO',
'SETTINGS_SECTIONS', 'SETTINGS_SECTIONS',
'SHARING_FEATURES',
'SHOW_CHROME_EXTENSION_BANNER', 'SHOW_CHROME_EXTENSION_BANNER',
'SHOW_DEEP_LINKING_IMAGE', 'SHOW_DEEP_LINKING_IMAGE',
'SHOW_POWERED_BY', 'SHOW_POWERED_BY',

View File

@@ -4,6 +4,7 @@ import React, { PureComponent } from 'react';
import { AudioSettingsButton, VideoSettingsButton } from '../../../../toolbox/components/web'; import { AudioSettingsButton, VideoSettingsButton } from '../../../../toolbox/components/web';
import { Avatar } from '../../../avatar'; import { Avatar } from '../../../avatar';
import { allowUrlSharing } from '../../functions';
import ConnectionStatus from './ConnectionStatus'; import ConnectionStatus from './ConnectionStatus';
import CopyMeetingUrl from './CopyMeetingUrl'; import CopyMeetingUrl from './CopyMeetingUrl';
@@ -79,6 +80,7 @@ export default class PreMeetingScreen extends PureComponent<Props> {
*/ */
render() { render() {
const { name, showAvatar, showConferenceInfo, title, videoMuted, videoTrack } = this.props; const { name, showAvatar, showConferenceInfo, title, videoMuted, videoTrack } = this.props;
const showSharingButton = allowUrlSharing();
return ( return (
<div <div
@@ -103,7 +105,7 @@ export default class PreMeetingScreen extends PureComponent<Props> {
<div className = 'title'> <div className = 'title'>
{ title } { title }
</div> </div>
<CopyMeetingUrl /> {showSharingButton ? <CopyMeetingUrl /> : null}
</> </>
)} )}
{ this.props.children } { this.props.children }

View File

@@ -4,6 +4,8 @@ import { findIndex } from 'lodash';
import { CONNECTION_TYPE } from './constants'; import { CONNECTION_TYPE } from './constants';
declare var interfaceConfig: Object;
const LOSS_AUDIO_THRESHOLDS = [ 0.33, 0.05 ]; const LOSS_AUDIO_THRESHOLDS = [ 0.33, 0.05 ];
const LOSS_VIDEO_THRESHOLDS = [ 0.33, 0.1, 0.05 ]; const LOSS_VIDEO_THRESHOLDS = [ 0.33, 0.1, 0.05 ];
@@ -211,3 +213,14 @@ export function getConnectionData(state: Object) {
connectionDetails: [] connectionDetails: []
}; };
} }
/**
* Returns if url sharing is enabled in interface configuration.
*
* @returns {boolean}
*/
export function allowUrlSharing() {
return typeof interfaceConfig === 'undefined'
|| typeof interfaceConfig.SHARING_FEATURES === 'undefined'
|| (interfaceConfig.SHARING_FEATURES.length && interfaceConfig.SHARING_FEATURES.indexOf('url') > -1);
}

View File

@@ -12,7 +12,14 @@ import { isVpaasMeeting } from '../../../../billing-counter/functions';
import EmbedMeetingTrigger from '../../../../embed-meeting/components/EmbedMeetingTrigger'; import EmbedMeetingTrigger from '../../../../embed-meeting/components/EmbedMeetingTrigger';
import { getActiveSession } from '../../../../recording'; import { getActiveSession } from '../../../../recording';
import { updateDialInNumbers } from '../../../actions'; import { updateDialInNumbers } from '../../../actions';
import { _getDefaultPhoneNumber, getInviteText, isAddPeopleEnabled, isDialOutEnabled } from '../../../functions'; import {
_getDefaultPhoneNumber,
getInviteText,
isAddPeopleEnabled,
isDialOutEnabled,
sharingFeatures,
isSharingEnabled
} from '../../../functions';
import CopyMeetingLinkSection from './CopyMeetingLinkSection'; import CopyMeetingLinkSection from './CopyMeetingLinkSection';
import DialInSection from './DialInSection'; import DialInSection from './DialInSection';
@@ -34,6 +41,21 @@ type Props = {
*/ */
_embedMeetingVisible: boolean, _embedMeetingVisible: boolean,
/**
* Whether or not dial in number should be visible.
*/
_dialInVisible: boolean,
/**
* Whether or not url sharing button should be visible.
*/
_urlSharingVisible: boolean,
/**
* Whether or not email sharing features should be visible.
*/
_emailSharingVisible: boolean,
/** /**
* The meeting invitation text. * The meeting invitation text.
*/ */
@@ -78,6 +100,9 @@ type Props = {
function AddPeopleDialog({ function AddPeopleDialog({
_dialIn, _dialIn,
_embedMeetingVisible, _embedMeetingVisible,
_dialInVisible,
_urlSharingVisible,
_emailSharingVisible,
_invitationText, _invitationText,
_inviteContactsVisible, _inviteContactsVisible,
_inviteUrl, _inviteUrl,
@@ -123,10 +148,14 @@ function AddPeopleDialog({
width = { 'small' }> width = { 'small' }>
<div className = 'invite-more-dialog'> <div className = 'invite-more-dialog'>
{ _inviteContactsVisible && <InviteContactsSection /> } { _inviteContactsVisible && <InviteContactsSection /> }
<CopyMeetingLinkSection url = { _inviteUrl } /> {_urlSharingVisible ? <CopyMeetingLinkSection url = { _inviteUrl } /> : null}
<InviteByEmailSection {
inviteSubject = { inviteSubject } _emailSharingVisible
inviteText = { _invitationText } /> ? <InviteByEmailSection
inviteSubject = { inviteSubject }
inviteText = { _invitationText } />
: null
}
{ _embedMeetingVisible && <EmbedMeetingTrigger /> } { _embedMeetingVisible && <EmbedMeetingTrigger /> }
<div className = 'invite-more-dialog separator' /> <div className = 'invite-more-dialog separator' />
{ {
@@ -134,7 +163,8 @@ function AddPeopleDialog({
&& <LiveStreamSection liveStreamViewURL = { _liveStreamViewURL } /> && <LiveStreamSection liveStreamViewURL = { _liveStreamViewURL } />
} }
{ {
_dialIn.numbers _phoneNumber
&& _dialInVisible
&& <DialInSection phoneNumber = { _phoneNumber } /> && <DialInSection phoneNumber = { _phoneNumber } />
} }
</div> </div>
@@ -163,7 +193,10 @@ function mapStateToProps(state, ownProps) {
return { return {
_dialIn: dialIn, _dialIn: dialIn,
_embedMeetingVisible: !isVpaasMeeting(state), _embedMeetingVisible: !isVpaasMeeting(state) && isSharingEnabled(sharingFeatures.embed),
_dialInVisible: isSharingEnabled(sharingFeatures.dialIn),
_urlSharingVisible: isSharingEnabled(sharingFeatures.url),
_emailSharingVisible: isSharingEnabled(sharingFeatures.email),
_invitationText: getInviteText({ state, _invitationText: getInviteText({ state,
phoneNumber, phoneNumber,
t: ownProps.t }), t: ownProps.t }),

View File

@@ -51,13 +51,13 @@ function DialInSection({
<DialInNumber <DialInNumber
conferenceID = { _dialIn.conferenceID } conferenceID = { _dialIn.conferenceID }
phoneNumber = { phoneNumber } /> phoneNumber = { phoneNumber } />
<a {_dialIn.numbers && _dialIn.numbers.length > 1 ? <a
className = 'more-numbers' className = 'more-numbers'
href = { _dialInfoPageUrl } href = { _dialInfoPageUrl }
rel = 'noopener noreferrer' rel = 'noopener noreferrer'
target = '_blank'> target = '_blank'>
{ t('info.moreNumbers') } { t('info.moreNumbers') }
</a> </a> : null}
</div> </div>
); );
} }

View File

@@ -720,3 +720,22 @@ export async function executeDialOutStatusRequest(url: string, reqId: string) {
return res.ok ? json : Promise.reject(json); return res.ok ? json : Promise.reject(json);
} }
export const sharingFeatures = {
email: 'email',
url: 'url',
dialIn: 'dial-in',
embed: 'embed'
};
/**
* Returns true if a specific sharing feature is enabled in interface configuration.
*
* @param {string} sharingFeature - The sharing feature to check.
* @returns {boolean}
*/
export function isSharingEnabled(sharingFeature: string) {
return typeof interfaceConfig === 'undefined'
|| typeof interfaceConfig.SHARING_FEATURES === 'undefined'
|| (interfaceConfig.SHARING_FEATURES.length && interfaceConfig.SHARING_FEATURES.indexOf(sharingFeature) > -1);
}