Browse Source

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
j8
Steffen Kolmer 4 years ago
parent
commit
5d8bf0c1e7
No account linked to committer's email address

+ 7
- 0
interface_config.js View File

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

+ 1
- 0
react/features/base/config/interfaceConfigWhitelist.js View File

@@ -43,6 +43,7 @@ export default [
43 43
     'RECENT_LIST_ENABLED',
44 44
     'REMOTE_THUMBNAIL_RATIO',
45 45
     'SETTINGS_SECTIONS',
46
+    'SHARING_FEATURES',
46 47
     'SHOW_CHROME_EXTENSION_BANNER',
47 48
     'SHOW_DEEP_LINKING_IMAGE',
48 49
     'SHOW_POWERED_BY',

+ 3
- 1
react/features/base/premeeting/components/web/PreMeetingScreen.js View File

@@ -4,6 +4,7 @@ import React, { PureComponent } from 'react';
4 4
 
5 5
 import { AudioSettingsButton, VideoSettingsButton } from '../../../../toolbox/components/web';
6 6
 import { Avatar } from '../../../avatar';
7
+import { allowUrlSharing } from '../../functions';
7 8
 
8 9
 import ConnectionStatus from './ConnectionStatus';
9 10
 import CopyMeetingUrl from './CopyMeetingUrl';
@@ -79,6 +80,7 @@ export default class PreMeetingScreen extends PureComponent<Props> {
79 80
      */
80 81
     render() {
81 82
         const { name, showAvatar, showConferenceInfo, title, videoMuted, videoTrack } = this.props;
83
+        const showSharingButton = allowUrlSharing();
82 84
 
83 85
         return (
84 86
             <div
@@ -103,7 +105,7 @@ export default class PreMeetingScreen extends PureComponent<Props> {
103 105
                             <div className = 'title'>
104 106
                                 { title }
105 107
                             </div>
106
-                            <CopyMeetingUrl />
108
+                            {showSharingButton ? <CopyMeetingUrl /> : null}
107 109
                         </>
108 110
                     )}
109 111
                     { this.props.children }

+ 13
- 0
react/features/base/premeeting/functions.js View File

@@ -4,6 +4,8 @@ import { findIndex } from 'lodash';
4 4
 
5 5
 import { CONNECTION_TYPE } from './constants';
6 6
 
7
+declare var interfaceConfig: Object;
8
+
7 9
 const LOSS_AUDIO_THRESHOLDS = [ 0.33, 0.05 ];
8 10
 const LOSS_VIDEO_THRESHOLDS = [ 0.33, 0.1, 0.05 ];
9 11
 
@@ -211,3 +213,14 @@ export function getConnectionData(state: Object) {
211 213
         connectionDetails: []
212 214
     };
213 215
 }
216
+
217
+/**
218
+ * Returns if url sharing is enabled in interface configuration.
219
+ *
220
+ * @returns {boolean}
221
+ */
222
+export function allowUrlSharing() {
223
+    return typeof interfaceConfig === 'undefined'
224
+        || typeof interfaceConfig.SHARING_FEATURES === 'undefined'
225
+        || (interfaceConfig.SHARING_FEATURES.length && interfaceConfig.SHARING_FEATURES.indexOf('url') > -1);
226
+}

+ 40
- 7
react/features/invite/components/add-people-dialog/web/AddPeopleDialog.js View File

@@ -12,7 +12,14 @@ import { isVpaasMeeting } from '../../../../billing-counter/functions';
12 12
 import EmbedMeetingTrigger from '../../../../embed-meeting/components/EmbedMeetingTrigger';
13 13
 import { getActiveSession } from '../../../../recording';
14 14
 import { updateDialInNumbers } from '../../../actions';
15
-import { _getDefaultPhoneNumber, getInviteText, isAddPeopleEnabled, isDialOutEnabled } from '../../../functions';
15
+import {
16
+    _getDefaultPhoneNumber,
17
+    getInviteText,
18
+    isAddPeopleEnabled,
19
+    isDialOutEnabled,
20
+    sharingFeatures,
21
+    isSharingEnabled
22
+} from '../../../functions';
16 23
 
17 24
 import CopyMeetingLinkSection from './CopyMeetingLinkSection';
18 25
 import DialInSection from './DialInSection';
@@ -34,6 +41,21 @@ type Props = {
34 41
      */
35 42
     _embedMeetingVisible: boolean,
36 43
 
44
+    /**
45
+     * Whether or not dial in number should be visible.
46
+     */
47
+    _dialInVisible: boolean,
48
+
49
+    /**
50
+     * Whether or not url sharing button should be visible.
51
+     */
52
+    _urlSharingVisible: boolean,
53
+
54
+    /**
55
+     * Whether or not email sharing features should be visible.
56
+     */
57
+    _emailSharingVisible: boolean,
58
+
37 59
     /**
38 60
      * The meeting invitation text.
39 61
      */
@@ -78,6 +100,9 @@ type Props = {
78 100
 function AddPeopleDialog({
79 101
     _dialIn,
80 102
     _embedMeetingVisible,
103
+    _dialInVisible,
104
+    _urlSharingVisible,
105
+    _emailSharingVisible,
81 106
     _invitationText,
82 107
     _inviteContactsVisible,
83 108
     _inviteUrl,
@@ -123,10 +148,14 @@ function AddPeopleDialog({
123 148
             width = { 'small' }>
124 149
             <div className = 'invite-more-dialog'>
125 150
                 { _inviteContactsVisible && <InviteContactsSection /> }
126
-                <CopyMeetingLinkSection url = { _inviteUrl } />
127
-                <InviteByEmailSection
128
-                    inviteSubject = { inviteSubject }
129
-                    inviteText = { _invitationText } />
151
+                {_urlSharingVisible ? <CopyMeetingLinkSection url = { _inviteUrl } /> : null}
152
+                {
153
+                    _emailSharingVisible
154
+                        ? <InviteByEmailSection
155
+                            inviteSubject = { inviteSubject }
156
+                            inviteText = { _invitationText } />
157
+                        : null
158
+                }
130 159
                 { _embedMeetingVisible && <EmbedMeetingTrigger /> }
131 160
                 <div className = 'invite-more-dialog separator' />
132 161
                 {
@@ -134,7 +163,8 @@ function AddPeopleDialog({
134 163
                         && <LiveStreamSection liveStreamViewURL = { _liveStreamViewURL } />
135 164
                 }
136 165
                 {
137
-                    _dialIn.numbers
166
+                    _phoneNumber
167
+                        && _dialInVisible
138 168
                         && <DialInSection phoneNumber = { _phoneNumber } />
139 169
                 }
140 170
             </div>
@@ -163,7 +193,10 @@ function mapStateToProps(state, ownProps) {
163 193
 
164 194
     return {
165 195
         _dialIn: dialIn,
166
-        _embedMeetingVisible: !isVpaasMeeting(state),
196
+        _embedMeetingVisible: !isVpaasMeeting(state) && isSharingEnabled(sharingFeatures.embed),
197
+        _dialInVisible: isSharingEnabled(sharingFeatures.dialIn),
198
+        _urlSharingVisible: isSharingEnabled(sharingFeatures.url),
199
+        _emailSharingVisible: isSharingEnabled(sharingFeatures.email),
167 200
         _invitationText: getInviteText({ state,
168 201
             phoneNumber,
169 202
             t: ownProps.t }),

+ 2
- 2
react/features/invite/components/add-people-dialog/web/DialInSection.js View File

@@ -51,13 +51,13 @@ function DialInSection({
51 51
             <DialInNumber
52 52
                 conferenceID = { _dialIn.conferenceID }
53 53
                 phoneNumber = { phoneNumber } />
54
-            <a
54
+            {_dialIn.numbers && _dialIn.numbers.length > 1 ? <a
55 55
                 className = 'more-numbers'
56 56
                 href = { _dialInfoPageUrl }
57 57
                 rel = 'noopener noreferrer'
58 58
                 target = '_blank'>
59 59
                 { t('info.moreNumbers') }
60
-            </a>
60
+            </a> : null}
61 61
         </div>
62 62
     );
63 63
 }

+ 19
- 0
react/features/invite/functions.js View File

@@ -720,3 +720,22 @@ export async function executeDialOutStatusRequest(url: string, reqId: string) {
720 720
 
721 721
     return res.ok ? json : Promise.reject(json);
722 722
 }
723
+
724
+export const sharingFeatures = {
725
+    email: 'email',
726
+    url: 'url',
727
+    dialIn: 'dial-in',
728
+    embed: 'embed'
729
+};
730
+
731
+/**
732
+ * Returns true if a specific sharing feature is enabled in interface configuration.
733
+ *
734
+ * @param {string} sharingFeature - The sharing feature to check.
735
+ * @returns {boolean}
736
+ */
737
+export function isSharingEnabled(sharingFeature: string) {
738
+    return typeof interfaceConfig === 'undefined'
739
+        || typeof interfaceConfig.SHARING_FEATURES === 'undefined'
740
+        || (interfaceConfig.SHARING_FEATURES.length && interfaceConfig.SHARING_FEATURES.indexOf(sharingFeature) > -1);
741
+}

Loading…
Cancel
Save