瀏覽代碼

fix(supportURL): Override true dynamic branding only.

factor2
Hristo Terezov 6 月之前
父節點
當前提交
c2f4dd9dea

+ 4
- 0
react/features/base/config/extraInterfaceConfigWhitelist.ts 查看文件

@@ -0,0 +1,4 @@
1
+/**
2
+ * Deploy-specific interface_config whitelists.
3
+ */
4
+export default [];

+ 3
- 2
react/features/base/config/interfaceConfigWhitelist.ts 查看文件

@@ -1,3 +1,5 @@
1
+import extraInterfaceConfigWhitelistCopy from './extraInterfaceConfigWhitelist';
2
+
1 3
 /**
2 4
  * The interface config keys to whitelist, the keys that can be overridden.
3 5
  *
@@ -45,7 +47,6 @@ export default [
45 47
     'SHARING_FEATURES',
46 48
     'SHOW_CHROME_EXTENSION_BANNER',
47 49
     'SHOW_POWERED_BY',
48
-    'SUPPORT_URL',
49 50
     'TILE_VIEW_MAX_COLUMNS',
50 51
     'TOOLBAR_ALWAYS_VISIBLE',
51 52
     'TOOLBAR_BUTTONS',
@@ -54,4 +55,4 @@ export default [
54 55
     'VERTICAL_FILMSTRIP',
55 56
     'VIDEO_LAYOUT_FIT',
56 57
     'VIDEO_QUALITY_LABEL_DISABLED'
57
-];
58
+].concat(extraInterfaceConfigWhitelistCopy);

+ 3
- 1
react/features/base/react/components/web/InlineDialogFailure.tsx 查看文件

@@ -1,9 +1,11 @@
1 1
 import React from 'react';
2 2
 import { useTranslation } from 'react-i18next';
3
+import { useSelector } from 'react-redux';
3 4
 import { makeStyles } from 'tss-react/mui';
4 5
 
5 6
 import { withPixelLineHeight } from '../../../styles/functions.web';
6 7
 import Button from '../../../ui/components/web/Button';
8
+import { getSupportUrl } from '../../functions';
7 9
 
8 10
 const useStyles = makeStyles()(theme => {
9 11
     return {
@@ -50,7 +52,7 @@ const InlineDialogFailure = ({
50 52
     const { t } = useTranslation();
51 53
     const { classes } = useStyles();
52 54
 
53
-    const supportLink = interfaceConfig.SUPPORT_URL;
55
+    const supportLink = useSelector(getSupportUrl);
54 56
     const supportString = t('inlineDialogFailure.supportMsg');
55 57
     const supportLinkElem = supportLink && showSupportLink
56 58
         ? (

+ 16
- 0
react/features/base/react/functions.ts 查看文件

@@ -1,5 +1,8 @@
1 1
 import punycode from 'punycode';
2 2
 
3
+import { IStateful } from '../app/types';
4
+import { toState } from '../redux/functions';
5
+
3 6
 /**
4 7
  * Returns the field value in a platform generic way.
5 8
  *
@@ -47,3 +50,16 @@ export function formatURLText(text = '') {
47 50
 
48 51
     return result;
49 52
 }
53
+
54
+/**
55
+ * Returns the configured support URL.
56
+ *
57
+ * @param {IStateful} stateful - The redux state.
58
+ * @returns {string|undefined} - The configured support link.
59
+ */
60
+export function getSupportUrl(stateful: IStateful) {
61
+
62
+    // TODO: Once overwriting trough interface config is completelly gone we should think of a way to be able to set
63
+    // the value in the branding and not return the default value from interface config.
64
+    return toState(stateful)['features/dynamic-branding'].supportUrl || interfaceConfig?.SUPPORT_URL;
65
+}

+ 4
- 2
react/features/dynamic-branding/middleware.native.ts 查看文件

@@ -25,7 +25,8 @@ MiddlewareRegistry.register(store => next => action => {
25 25
             didPageUrl,
26 26
             inviteDomain,
27 27
             labels,
28
-            sharedVideoAllowedURLDomains
28
+            sharedVideoAllowedURLDomains,
29
+            supportUrl
29 30
         } = action.value;
30 31
 
31 32
         action.value = {
@@ -36,7 +37,8 @@ MiddlewareRegistry.register(store => next => action => {
36 37
             didPageUrl,
37 38
             inviteDomain,
38 39
             labels,
39
-            sharedVideoAllowedURLDomains
40
+            sharedVideoAllowedURLDomains,
41
+            supportUrl
40 42
         };
41 43
 
42 44
         // The backend may send an empty string, make sure we skip that.

+ 3
- 0
react/features/dynamic-branding/reducer.ts 查看文件

@@ -159,6 +159,7 @@ export interface IDynamicBrandingState {
159 159
     premeetingBackground: string;
160 160
     sharedVideoAllowedURLDomains?: Array<string>;
161 161
     showGiphyIntegration?: boolean;
162
+    supportUrl?: string;
162 163
     useDynamicBrandingData: boolean;
163 164
     virtualBackgrounds: Array<Image>;
164 165
 }
@@ -184,6 +185,7 @@ ReducerRegistry.register<IDynamicBrandingState>(STORE_NAME, (state = DEFAULT_STA
184 185
             premeetingBackground,
185 186
             sharedVideoAllowedURLDomains,
186 187
             showGiphyIntegration,
188
+            supportUrl,
187 189
             virtualBackgrounds
188 190
         } = action.value;
189 191
 
@@ -202,6 +204,7 @@ ReducerRegistry.register<IDynamicBrandingState>(STORE_NAME, (state = DEFAULT_STA
202 204
             premeetingBackground,
203 205
             sharedVideoAllowedURLDomains,
204 206
             showGiphyIntegration,
207
+            supportUrl,
205 208
             customizationFailed: false,
206 209
             customizationReady: true,
207 210
             useDynamicBrandingData: true,

+ 9
- 6
react/features/notifications/components/web/Notification.tsx 查看文件

@@ -1,6 +1,7 @@
1 1
 import { Theme } from '@mui/material';
2 2
 import React, { isValidElement, useCallback, useContext } from 'react';
3 3
 import { useTranslation } from 'react-i18next';
4
+import { useSelector } from 'react-redux';
4 5
 import { keyframes } from 'tss-react';
5 6
 import { makeStyles } from 'tss-react/mui';
6 7
 
@@ -15,6 +16,7 @@ import {
15 16
     IconWarningCircle
16 17
 } from '../../../base/icons/svg';
17 18
 import Message from '../../../base/react/components/web/Message';
19
+import { getSupportUrl } from '../../../base/react/functions';
18 20
 import { withPixelLineHeight } from '../../../base/styles/functions.web';
19 21
 import { NOTIFICATION_ICON, NOTIFICATION_TYPE } from '../../constants';
20 22
 import { INotificationProps } from '../../types';
@@ -190,6 +192,7 @@ const Notification = ({
190 192
     const { classes, cx, theme } = useStyles();
191 193
     const { t } = useTranslation();
192 194
     const { unmounting } = useContext(NotificationsTransitionContext);
195
+    const supportUrl = useSelector(getSupportUrl);
193 196
 
194 197
     const ICON_COLOR = {
195 198
         error: theme.palette.iconError,
@@ -229,9 +232,9 @@ const Notification = ({
229 232
         );
230 233
     }, [ description, descriptionArguments, descriptionKey, classes ]);
231 234
 
232
-    const _onOpenSupportLink = () => {
233
-        window.open(interfaceConfig.SUPPORT_URL, '_blank', 'noopener');
234
-    };
235
+    const _onOpenSupportLink = useCallback(() => {
236
+        window.open(supportUrl, '_blank', 'noopener');
237
+    }, [ supportUrl ]);
235 238
 
236 239
     const mapAppearanceToButtons = useCallback((): {
237 240
         content: string; onClick: () => void; testId?: string; type?: string; }[] => {
@@ -244,7 +247,7 @@ const Notification = ({
244 247
                 }
245 248
             ];
246 249
 
247
-            if (!hideErrorSupportLink && interfaceConfig.SUPPORT_URL) {
250
+            if (!hideErrorSupportLink && supportUrl) {
248 251
                 buttons.push({
249 252
                     content: t('dialog.contactSupport'),
250 253
                     onClick: _onOpenSupportLink
@@ -279,7 +282,7 @@ const Notification = ({
279 282
 
280 283
             return [];
281 284
         }
282
-    }, [ appearance, onDismiss, customActionHandler, customActionNameKey, hideErrorSupportLink ]);
285
+    }, [ appearance, onDismiss, customActionHandler, customActionNameKey, hideErrorSupportLink, supportUrl ]);
283 286
 
284 287
     const getIcon = useCallback(() => {
285 288
         let iconToDisplay;
@@ -313,7 +316,7 @@ const Notification = ({
313 316
         <div
314 317
             aria-atomic = 'false'
315 318
             aria-live = 'polite'
316
-            className = { cx(classes.container, unmounting.get(uid ?? '') && 'unmount') }
319
+            className = { cx(classes.container, (unmounting.get(uid ?? '') && 'unmount') as string | undefined) }
317 320
             data-testid = { titleKey || descriptionKey }
318 321
             id = { uid }>
319 322
             <div className = { cx(classes.ribbon, appearance) } />

Loading…
取消
儲存