소스 검색

feat(config): Add config option for making display name read only

master
Vlad Piersec 4 년 전
부모
커밋
fc6e8fd4b9

+ 4
- 0
config.js 파일 보기

@@ -476,6 +476,10 @@ var config = {
476 476
     // When 'true', it shows an intermediate page before joining, where the user can configure their devices.
477 477
     // prejoinPageEnabled: false,
478 478
 
479
+    // When 'true', the user cannot edit the display name.
480
+    // (Mainly useful when used in conjuction with the JWT so the JWT name becomes read only.)
481
+    // readOnlyName: false,
482
+
479 483
     // If etherpad integration is enabled, setting this to true will
480 484
     // automatically open the etherpad when a participant joins.  This
481 485
     // does not affect the mobile app since opening an etherpad

+ 1
- 0
react/features/base/config/configWhitelist.js 파일 보기

@@ -175,6 +175,7 @@ export default [
175 175
     'requireDisplayName',
176 176
     'remoteVideoMenu',
177 177
     'roomPasswordNumberOfDigits',
178
+    'readOnlyName',
178 179
     'replaceParticipant',
179 180
     'resolution',
180 181
     'startAudioMuted',

+ 12
- 0
react/features/base/config/functions.any.js 파일 보기

@@ -152,6 +152,18 @@ export function getWhitelistedJSON(configName: string, configJSON: Object): Obje
152 152
     return configJSON;
153 153
 }
154 154
 
155
+/**
156
+ * Selector for determining if the display name is read only.
157
+ *
158
+ * @param {Object} state - The state of the app.
159
+ * @returns {boolean}
160
+ */
161
+export function isNameReadOnly(state: Object): boolean {
162
+    return state['features/base/config'].disableProfile
163
+        || state['features/base/config'].readOnlyName;
164
+}
165
+
166
+
155 167
 /**
156 168
  * Restores a Jitsi Meet config.js from {@code localStorage} if it was
157 169
  * previously downloaded from a specific {@code baseURL} and stored with

+ 6
- 0
react/features/base/premeeting/components/web/InputField.js 파일 보기

@@ -36,6 +36,11 @@ type Props = {
36 36
      */
37 37
     placeHolder: string,
38 38
 
39
+    /**
40
+     * Whether the input is read only or not.
41
+     */
42
+    readOnly?: boolean,
43
+
39 44
     /**
40 45
      * The field type (e.g. text, password...etc).
41 46
      */
@@ -126,6 +131,7 @@ export default class InputField extends PureComponent<Props, State> {
126 131
                 onFocus = { this._onFocus }
127 132
                 onKeyDown = { this._onKeyDown }
128 133
                 placeholder = { this.props.placeHolder }
134
+                readOnly = { this.props.readOnly }
129 135
                 type = { this.props.type }
130 136
                 value = { this.state.value } />
131 137
         );

+ 9
- 9
react/features/filmstrip/components/web/Thumbnail.js 파일 보기

@@ -5,6 +5,7 @@ import React, { Component } from 'react';
5 5
 import { createScreenSharingIssueEvent, sendAnalytics } from '../../../analytics';
6 6
 import { AudioLevelIndicator } from '../../../audio-level-indicator';
7 7
 import { Avatar } from '../../../base/avatar';
8
+import { isNameReadOnly } from '../../../base/config';
8 9
 import { isMobileBrowser } from '../../../base/environment/utils';
9 10
 import JitsiMeetJS from '../../../base/lib-jitsi-meet/_';
10 11
 import { MEDIA_TYPE, VideoTrack } from '../../../base/media';
@@ -73,6 +74,11 @@ export type State = {|
73 74
  */
74 75
 export type Props = {|
75 76
 
77
+    /**
78
+     * If the display name is editable or not.
79
+     */
80
+    _allowEditing: boolean,
81
+
76 82
     /**
77 83
      * The audio track related to the participant.
78 84
      */
@@ -103,11 +109,6 @@ export type Props = {|
103 109
      */
104 110
     _disableLocalVideoFlip: boolean,
105 111
 
106
-    /**
107
-     * Indicates whether the profile functionality is disabled.
108
-     */
109
-    _disableProfile: boolean,
110
-
111 112
     /**
112 113
      * The display mode of the thumbnail.
113 114
      */
@@ -763,13 +764,13 @@ class Thumbnail extends Component<Props, State> {
763 764
      */
764 765
     _renderLocalParticipant() {
765 766
         const {
767
+            _allowEditing,
766 768
             _defaultLocalDisplayName,
767 769
             _disableLocalVideoFlip,
768 770
             _isMobile,
769 771
             _isMobilePortrait,
770 772
             _isScreenSharing,
771 773
             _localFlipX,
772
-            _disableProfile,
773 774
             _participant,
774 775
             _videoTrack
775 776
         } = this.props;
@@ -820,7 +821,7 @@ class Thumbnail extends Component<Props, State> {
820 821
                     className = 'displayNameContainer'
821 822
                     onClick = { onClick }>
822 823
                     <DisplayName
823
-                        allowEditing = { !_disableProfile }
824
+                        allowEditing = { _allowEditing }
824 825
                         displayNameSuffix = { _defaultLocalDisplayName }
825 826
                         elementID = 'localDisplayName'
826 827
                         participantID = { id } />
@@ -1053,7 +1054,6 @@ function _mapStateToProps(state, ownProps): Object {
1053 1054
     const {
1054 1055
         startSilent,
1055 1056
         disableLocalVideoFlip,
1056
-        disableProfile,
1057 1057
         iAmRecorder,
1058 1058
         iAmSipGateway
1059 1059
     } = state['features/base/config'];
@@ -1102,6 +1102,7 @@ function _mapStateToProps(state, ownProps): Object {
1102 1102
     }
1103 1103
 
1104 1104
     return {
1105
+        _allowEditing: !isNameReadOnly(state),
1105 1106
         _audioTrack,
1106 1107
         _connectionIndicatorAutoHideEnabled:
1107 1108
         Boolean(state['features/base/config'].connectionIndicators?.autoHide ?? true),
@@ -1110,7 +1111,6 @@ function _mapStateToProps(state, ownProps): Object {
1110 1111
         _currentLayout,
1111 1112
         _defaultLocalDisplayName: interfaceConfig.DEFAULT_LOCAL_DISPLAY_NAME,
1112 1113
         _disableLocalVideoFlip: Boolean(disableLocalVideoFlip),
1113
-        _disableProfile: disableProfile,
1114 1114
         _isHidden: isLocal && iAmRecorder && !iAmSipGateway,
1115 1115
         _isAudioOnly: Boolean(state['features/base/audio-only'].enabled),
1116 1116
         _isCurrentlyOnLargeVideo: state['features/large-video']?.participantId === id,

+ 9
- 0
react/features/prejoin/components/Prejoin.js 파일 보기

@@ -4,6 +4,7 @@ import InlineDialog from '@atlaskit/inline-dialog';
4 4
 import React, { Component } from 'react';
5 5
 
6 6
 import { getRoomName } from '../../base/conference';
7
+import { isNameReadOnly } from '../../base/config';
7 8
 import { translate } from '../../base/i18n';
8 9
 import { Icon, IconArrowDown, IconArrowUp, IconPhone, IconVolumeOff } from '../../base/icons';
9 10
 import { isVideoMutedByUser } from '../../base/media';
@@ -57,6 +58,11 @@ type Props = {
57 58
      */
58 59
     updateSettings: Function,
59 60
 
61
+    /**
62
+     * Whether the name input should be read only or not.
63
+     */
64
+    readOnlyName: boolean,
65
+
60 66
     /**
61 67
      * The name of the meeting that is about to be joined.
62 68
      */
@@ -283,6 +289,7 @@ class Prejoin extends Component<Props, State> {
283 289
             joinConference,
284 290
             joinConferenceWithoutAudio,
285 291
             name,
292
+            readOnlyName,
286 293
             showCameraPreview,
287 294
             showDialog,
288 295
             t,
@@ -310,6 +317,7 @@ class Prejoin extends Component<Props, State> {
310 317
                         onChange = { _setName }
311 318
                         onSubmit = { joinConference }
312 319
                         placeHolder = { t('dialog.enterDisplayName') }
320
+                        readOnly = { readOnlyName }
313 321
                         value = { name } />
314 322
 
315 323
                     {showError && <div
@@ -393,6 +401,7 @@ function mapStateToProps(state): Object {
393 401
         showDialog: isJoinByPhoneDialogVisible(state),
394 402
         showErrorOnJoin,
395 403
         hasJoinByPhoneButton: isJoinByPhoneButtonVisible(state),
404
+        readOnlyName: isNameReadOnly(state),
396 405
         showCameraPreview: !isVideoMutedByUser(state),
397 406
         videoTrack: getLocalJitsiVideoTrack(state)
398 407
     };

+ 7
- 0
react/features/settings/components/web/ProfileTab.js 파일 보기

@@ -42,6 +42,11 @@ export type Props = {
42 42
      */
43 43
     email: string,
44 44
 
45
+    /**
46
+     * If the display name is read only.
47
+     */
48
+    readOnlyName: boolean,
49
+
45 50
     /**
46 51
      * Invoked to obtain translated strings.
47 52
      */
@@ -111,6 +116,7 @@ class ProfileTab extends AbstractDialogTab<Props> {
111 116
             authEnabled,
112 117
             displayName,
113 118
             email,
119
+            readOnlyName,
114 120
             t
115 121
         } = this.props;
116 122
 
@@ -122,6 +128,7 @@ class ProfileTab extends AbstractDialogTab<Props> {
122 128
                             autoComplete = 'name'
123 129
                             compact = { true }
124 130
                             id = 'setDisplayName'
131
+                            isReadOnly = { readOnlyName }
125 132
                             label = { t('profile.setDisplayNameLabel') }
126 133
                             onChange = { this._onDisplayNameChange }
127 134
                             placeholder = { t('settings.name') }

+ 3
- 1
react/features/settings/functions.js 파일 보기

@@ -1,5 +1,6 @@
1 1
 // @flow
2 2
 
3
+import { isNameReadOnly } from '../base/config';
3 4
 import { SERVER_URL_CHANGE_ENABLED, getFeatureFlag } from '../base/flags';
4 5
 import { i18next, DEFAULT_LANGUAGE, LANGUAGES } from '../base/i18n';
5 6
 import { createLocalTrack } from '../base/lib-jitsi-meet/functions';
@@ -153,7 +154,8 @@ export function getProfileTabProps(stateful: Object | Function) {
153 154
         authEnabled: Boolean(conference && authEnabled),
154 155
         authLogin,
155 156
         displayName: localParticipant.name,
156
-        email: localParticipant.email
157
+        email: localParticipant.email,
158
+        readOnlyName: isNameReadOnly(state)
157 159
     };
158 160
 }
159 161
 

Loading…
취소
저장