Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(supportURL): Override true dynamic branding only. #15329

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions react/features/base/config/extraInterfaceConfigWhitelist.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/**
* Deploy-specific interface_config whitelists.
*/
export default [];
5 changes: 3 additions & 2 deletions react/features/base/config/interfaceConfigWhitelist.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import extraInterfaceConfigWhitelistCopy from './extraInterfaceConfigWhitelist';

/**
* The interface config keys to whitelist, the keys that can be overridden.
*
Expand Down Expand Up @@ -45,7 +47,6 @@ export default [
'SHARING_FEATURES',
'SHOW_CHROME_EXTENSION_BANNER',
'SHOW_POWERED_BY',
'SUPPORT_URL',
'TILE_VIEW_MAX_COLUMNS',
'TOOLBAR_ALWAYS_VISIBLE',
'TOOLBAR_BUTTONS',
Expand All @@ -54,4 +55,4 @@ export default [
'VERTICAL_FILMSTRIP',
'VIDEO_LAYOUT_FIT',
'VIDEO_QUALITY_LABEL_DISABLED'
];
].concat(extraInterfaceConfigWhitelistCopy);
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import React from 'react';
import { useTranslation } from 'react-i18next';
import { useSelector } from 'react-redux';
import { makeStyles } from 'tss-react/mui';

import { withPixelLineHeight } from '../../../styles/functions.web';
import Button from '../../../ui/components/web/Button';
import { getSupportUrl } from '../../functions';

const useStyles = makeStyles()(theme => {
return {
Expand Down Expand Up @@ -50,7 +52,7 @@ const InlineDialogFailure = ({
const { t } = useTranslation();
const { classes } = useStyles();

const supportLink = interfaceConfig.SUPPORT_URL;
const supportLink = useSelector(getSupportUrl);
const supportString = t('inlineDialogFailure.supportMsg');
const supportLinkElem = supportLink && showSupportLink
? (
Expand Down
16 changes: 16 additions & 0 deletions react/features/base/react/functions.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import punycode from 'punycode';

import { IStateful } from '../app/types';
import { toState } from '../redux/functions';

/**
* Returns the field value in a platform generic way.
*
Expand Down Expand Up @@ -47,3 +50,16 @@ export function formatURLText(text = '') {

return result;
}

/**
* Returns the configured support URL.
*
* @param {IStateful} stateful - The redux state.
* @returns {string|undefined} - The configured support link.
*/
export function getSupportUrl(stateful: IStateful) {

// TODO: Once overwriting trough interface config is completelly gone we should think of a way to be able to set
// the value in the branding and not return the default value from interface config.
return toState(stateful)['features/dynamic-branding'].supportUrl || interfaceConfig?.SUPPORT_URL;
}
6 changes: 4 additions & 2 deletions react/features/dynamic-branding/middleware.native.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ MiddlewareRegistry.register(store => next => action => {
didPageUrl,
inviteDomain,
labels,
sharedVideoAllowedURLDomains
sharedVideoAllowedURLDomains,
supportUrl
} = action.value;

action.value = {
Expand All @@ -36,7 +37,8 @@ MiddlewareRegistry.register(store => next => action => {
didPageUrl,
inviteDomain,
labels,
sharedVideoAllowedURLDomains
sharedVideoAllowedURLDomains,
supportUrl
};

// The backend may send an empty string, make sure we skip that.
Expand Down
3 changes: 3 additions & 0 deletions react/features/dynamic-branding/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ export interface IDynamicBrandingState {
premeetingBackground: string;
sharedVideoAllowedURLDomains?: Array<string>;
showGiphyIntegration?: boolean;
supportUrl?: string;
useDynamicBrandingData: boolean;
virtualBackgrounds: Array<Image>;
}
Expand All @@ -184,6 +185,7 @@ ReducerRegistry.register<IDynamicBrandingState>(STORE_NAME, (state = DEFAULT_STA
premeetingBackground,
sharedVideoAllowedURLDomains,
showGiphyIntegration,
supportUrl,
virtualBackgrounds
} = action.value;

Expand All @@ -202,6 +204,7 @@ ReducerRegistry.register<IDynamicBrandingState>(STORE_NAME, (state = DEFAULT_STA
premeetingBackground,
sharedVideoAllowedURLDomains,
showGiphyIntegration,
supportUrl,
customizationFailed: false,
customizationReady: true,
useDynamicBrandingData: true,
Expand Down
15 changes: 9 additions & 6 deletions react/features/notifications/components/web/Notification.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Theme } from '@mui/material';
import React, { isValidElement, useCallback, useContext } from 'react';
import { useTranslation } from 'react-i18next';
import { useSelector } from 'react-redux';
import { keyframes } from 'tss-react';
import { makeStyles } from 'tss-react/mui';

Expand All @@ -15,6 +16,7 @@ import {
IconWarningCircle
} from '../../../base/icons/svg';
import Message from '../../../base/react/components/web/Message';
import { getSupportUrl } from '../../../base/react/functions';
import { withPixelLineHeight } from '../../../base/styles/functions.web';
import { NOTIFICATION_ICON, NOTIFICATION_TYPE } from '../../constants';
import { INotificationProps } from '../../types';
Expand Down Expand Up @@ -190,6 +192,7 @@ const Notification = ({
const { classes, cx, theme } = useStyles();
const { t } = useTranslation();
const { unmounting } = useContext(NotificationsTransitionContext);
const supportUrl = useSelector(getSupportUrl);

const ICON_COLOR = {
error: theme.palette.iconError,
Expand Down Expand Up @@ -229,9 +232,9 @@ const Notification = ({
);
}, [ description, descriptionArguments, descriptionKey, classes ]);

const _onOpenSupportLink = () => {
window.open(interfaceConfig.SUPPORT_URL, '_blank', 'noopener');
};
const _onOpenSupportLink = useCallback(() => {
window.open(supportUrl, '_blank', 'noopener');
}, [ supportUrl ]);

const mapAppearanceToButtons = useCallback((): {
content: string; onClick: () => void; testId?: string; type?: string; }[] => {
Expand All @@ -244,7 +247,7 @@ const Notification = ({
}
];

if (!hideErrorSupportLink && interfaceConfig.SUPPORT_URL) {
if (!hideErrorSupportLink && supportUrl) {
buttons.push({
content: t('dialog.contactSupport'),
onClick: _onOpenSupportLink
Expand Down Expand Up @@ -279,7 +282,7 @@ const Notification = ({

return [];
}
}, [ appearance, onDismiss, customActionHandler, customActionNameKey, hideErrorSupportLink ]);
}, [ appearance, onDismiss, customActionHandler, customActionNameKey, hideErrorSupportLink, supportUrl ]);

const getIcon = useCallback(() => {
let iconToDisplay;
Expand Down Expand Up @@ -313,7 +316,7 @@ const Notification = ({
<div
aria-atomic = 'false'
aria-live = 'polite'
className = { cx(classes.container, unmounting.get(uid ?? '') && 'unmount') }
className = { cx(classes.container, (unmounting.get(uid ?? '') && 'unmount') as string | undefined) }
data-testid = { titleKey || descriptionKey }
id = { uid }>
<div className = { cx(classes.ribbon, appearance) } />
Expand Down