Selaa lähdekoodia

feat: Profile tab does not depend on isGuest.

Introduced a config property to disable profile.
master
damencho 4 vuotta sitten
vanhempi
commit
9fa29d7353

+ 3
- 0
config.js Näytä tiedosto

@@ -359,6 +359,9 @@ var config = {
359 359
     // Default language for the user interface.
360 360
     // defaultLanguage: 'en',
361 361
 
362
+    // Disables profile and the edit of all fields from the profile settings (display name and email)
363
+    // disableProfile: false,
364
+
362 365
     // If true all users without a token will be considered guests and all users
363 366
     // with token will be considered non-guests. Only guests will be allowed to
364 367
     // edit their profile.

+ 1
- 1
modules/UI/videolayout/LocalVideo.js Näytä tiedosto

@@ -104,7 +104,7 @@ export default class LocalVideo extends SmallVideo {
104 104
         }
105 105
 
106 106
         this._renderDisplayName({
107
-            allowEditing: APP.store.getState()['features/base/jwt'].isGuest,
107
+            allowEditing: !config.disableProfile,
108 108
             displayNameSuffix: interfaceConfig.DEFAULT_LOCAL_DISPLAY_NAME,
109 109
             elementID: 'localDisplayName',
110 110
             participantID: this.id

+ 1
- 0
react/features/base/config/configWhitelist.js Näytä tiedosto

@@ -85,6 +85,7 @@ export default [
85 85
     'disableInviteFunctions',
86 86
     'disableLocalVideoFlip',
87 87
     'disableNS',
88
+    'disableProfile',
88 89
     'disableRemoteControl',
89 90
     'disableRemoteMute',
90 91
     'disableRtx',

+ 2
- 4
react/features/base/jwt/functions.js Näytä tiedosto

@@ -1,7 +1,5 @@
1 1
 /* @flow */
2 2
 
3
-import jwtDecode from 'jwt-decode';
4
-
5 3
 import { parseURLParams } from '../util';
6 4
 
7 5
 /**
@@ -24,7 +22,7 @@ export function parseJWTFromURLParams(url: URL = window.location) {
24 22
  * @returns {string}
25 23
  */
26 24
 export function getJwtName(state: Object) {
27
-    const jwtData = jwtDecode(state['features/base/jwt'].jwt);
25
+    const { user } = state['features/base/jwt'];
28 26
 
29
-    return jwtData?.context?.user?.name || '';
27
+    return user?.name || '';
30 28
 }

+ 1
- 2
react/features/settings/components/web/SettingsDialog.js Näytä tiedosto

@@ -126,14 +126,13 @@ class SettingsDialog extends Component<Props> {
126 126
  */
127 127
 function _mapStateToProps(state) {
128 128
     const configuredTabs = interfaceConfig.SETTINGS_SECTIONS || [];
129
-    const jwt = state['features/base/jwt'];
130 129
 
131 130
     // The settings sections to display.
132 131
     const showDeviceSettings = configuredTabs.includes('devices');
133 132
     const moreTabProps = getMoreTabProps(state);
134 133
     const { showModeratorSettings, showLanguageSettings, showPrejoinSettings } = moreTabProps;
135 134
     const showProfileSettings
136
-        = configuredTabs.includes('profile') && jwt.isGuest;
135
+        = configuredTabs.includes('profile') && !state['features/base/config'].disableProfile;
137 136
     const showCalendarSettings
138 137
         = configuredTabs.includes('calendar') && isCalendarEnabled(state);
139 138
     const tabs = [];

+ 1
- 1
react/features/toolbox/components/web/OverflowMenuProfileItem.js Näytä tiedosto

@@ -120,7 +120,7 @@ class OverflowMenuProfileItem extends Component<Props> {
120 120
 function _mapStateToProps(state) {
121 121
     return {
122 122
         _localParticipant: getLocalParticipant(state),
123
-        _unclickable: !state['features/base/jwt'].isGuest
123
+        _unclickable: state['features/base/config'].disableProfile
124 124
             || !interfaceConfig.SETTINGS_SECTIONS.includes('profile')
125 125
     };
126 126
 }

+ 6
- 6
react/features/toolbox/components/web/Toolbox.js Näytä tiedosto

@@ -129,14 +129,14 @@ type Props = {
129 129
     _fullScreen: boolean,
130 130
 
131 131
     /**
132
-     * Whether or not the tile view is enabled.
132
+     * Whether or not the profile is disabled.
133 133
      */
134
-    _tileViewEnabled: boolean,
134
+    _isProfileDisabled: boolean,
135 135
 
136 136
     /**
137
-     * Whether or not the current user is logged in through a JWT.
137
+     * Whether or not the tile view is enabled.
138 138
      */
139
-    _isGuest: boolean,
139
+    _tileViewEnabled: boolean,
140 140
 
141 141
     /**
142 142
      * Whether or not the current meeting belongs to a JaaS user.
@@ -993,7 +993,7 @@ class Toolbox extends Component<Props, State> {
993 993
      * @returns {boolean}
994 994
      */
995 995
     _isProfileVisible() {
996
-        return this.props._isGuest && this._shouldShowButton('profile');
996
+        return !this.props._isProfileDisabled && this._shouldShowButton('profile');
997 997
     }
998 998
 
999 999
     /**
@@ -1448,7 +1448,7 @@ function _mapStateToProps(state) {
1448 1448
         _desktopSharingDisabledTooltipKey: desktopSharingDisabledTooltipKey,
1449 1449
         _dialog: Boolean(state['features/base/dialog'].component),
1450 1450
         _feedbackConfigured: Boolean(callStatsID),
1451
-        _isGuest: state['features/base/jwt'].isGuest,
1451
+        _isProfileDisabled: Boolean(state['features/base/config'].disableProfile),
1452 1452
         _isVpaasMeeting: isVpaasMeeting(state),
1453 1453
         _fullScreen: fullScreen,
1454 1454
         _tileViewEnabled: shouldDisplayTileView(state),

Loading…
Peruuta
Tallenna