mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
MM-53274 - Add a "feature flag" for Calls ringing (#23810)
* add "feature flag" for calls ringing * tests
This commit is contained in:
parent
bea5b05533
commit
a7bf602478
@ -33,7 +33,7 @@ describe('components/user_settings/notifications/DesktopNotificationSettings', (
|
|||||||
threads: NotificationLevels.ALL,
|
threads: NotificationLevels.ALL,
|
||||||
callsSelectedSound: 'Dynamic',
|
callsSelectedSound: 'Dynamic',
|
||||||
callsSound: 'false',
|
callsSound: 'false',
|
||||||
isCallsEnabled: false,
|
isCallsRingingEnabled: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
test('should match snapshot, on max setting', () => {
|
test('should match snapshot, on max setting', () => {
|
||||||
@ -54,7 +54,7 @@ describe('components/user_settings/notifications/DesktopNotificationSettings', (
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('should match snapshot, on max setting with Calls enabled', () => {
|
test('should match snapshot, on max setting with Calls enabled', () => {
|
||||||
const props = {...baseProps, isCallsEnabled: true};
|
const props = {...baseProps, isCallsRingingEnabled: true};
|
||||||
const wrapper = shallow(
|
const wrapper = shallow(
|
||||||
<DesktopNotificationSettings {...props}/>,
|
<DesktopNotificationSettings {...props}/>,
|
||||||
);
|
);
|
||||||
@ -63,7 +63,7 @@ describe('components/user_settings/notifications/DesktopNotificationSettings', (
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('should match snapshot, on max setting with Calls enabled, calls sound true', () => {
|
test('should match snapshot, on max setting with Calls enabled, calls sound true', () => {
|
||||||
const props = {...baseProps, isCallsEnabled: true, callsSound: 'true'};
|
const props = {...baseProps, isCallsRingingEnabled: true, callsSound: 'true'};
|
||||||
const wrapper = shallow(
|
const wrapper = shallow(
|
||||||
<DesktopNotificationSettings {...props}/>,
|
<DesktopNotificationSettings {...props}/>,
|
||||||
);
|
);
|
||||||
|
@ -35,7 +35,7 @@ type Props = {
|
|||||||
selectedSound: string;
|
selectedSound: string;
|
||||||
callsSelectedSound: string;
|
callsSelectedSound: string;
|
||||||
isCollapsedThreadsEnabled: boolean;
|
isCollapsedThreadsEnabled: boolean;
|
||||||
isCallsEnabled: boolean;
|
isCallsRingingEnabled: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
type State = {
|
type State = {
|
||||||
@ -164,7 +164,7 @@ export default class DesktopNotificationSettings extends React.PureComponent<Pro
|
|||||||
/></div>);
|
/></div>);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.props.isCallsEnabled) {
|
if (this.props.isCallsRingingEnabled) {
|
||||||
const callsSoundRadio = [false, false];
|
const callsSoundRadio = [false, false];
|
||||||
if (this.props.callsSound === 'false') {
|
if (this.props.callsSound === 'false') {
|
||||||
callsSoundRadio[1] = true;
|
callsSoundRadio[1] = true;
|
||||||
|
@ -12,7 +12,7 @@ import {ActionFunc} from 'mattermost-redux/types/actions';
|
|||||||
import {GlobalState} from 'types/store';
|
import {GlobalState} from 'types/store';
|
||||||
|
|
||||||
import UserSettingsNotifications, {Props} from './user_settings_notifications';
|
import UserSettingsNotifications, {Props} from './user_settings_notifications';
|
||||||
import {isCallsEnabled} from 'selectors/calls';
|
import {isCallsEnabled, isCallsRingingEnabled} from 'selectors/calls';
|
||||||
|
|
||||||
function mapStateToProps(state: GlobalState) {
|
function mapStateToProps(state: GlobalState) {
|
||||||
const config = getConfig(state);
|
const config = getConfig(state);
|
||||||
@ -24,7 +24,7 @@ function mapStateToProps(state: GlobalState) {
|
|||||||
sendPushNotifications,
|
sendPushNotifications,
|
||||||
enableAutoResponder,
|
enableAutoResponder,
|
||||||
isCollapsedThreadsEnabled: isCollapsedThreadsEnabled(state),
|
isCollapsedThreadsEnabled: isCollapsedThreadsEnabled(state),
|
||||||
isCallsEnabled: isCallsEnabled(state, '0.17.0'),
|
isCallsRingingEnabled: isCallsEnabled(state, '0.17.0') && isCallsRingingEnabled(state),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ describe('components/user_settings/display/UserSettingsDisplay', () => {
|
|||||||
isCollapsedThreadsEnabled: false,
|
isCollapsedThreadsEnabled: false,
|
||||||
sendPushNotifications: false,
|
sendPushNotifications: false,
|
||||||
enableAutoResponder: false,
|
enableAutoResponder: false,
|
||||||
isCallsEnabled: true,
|
isCallsRingingEnabled: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
test('should have called handleSubmit', async () => {
|
test('should have called handleSubmit', async () => {
|
||||||
|
@ -36,7 +36,7 @@ export type Props = {
|
|||||||
updateMe: (user: UserProfile) => Promise<ActionResult>;
|
updateMe: (user: UserProfile) => Promise<ActionResult>;
|
||||||
};
|
};
|
||||||
isCollapsedThreadsEnabled: boolean;
|
isCollapsedThreadsEnabled: boolean;
|
||||||
isCallsEnabled: boolean;
|
isCallsRingingEnabled: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
type State = {
|
type State = {
|
||||||
@ -1058,7 +1058,7 @@ export default class NotificationsTab extends React.PureComponent<Props, State>
|
|||||||
callsSelectedSound={this.state.callsNotificationSound || 'default'}
|
callsSelectedSound={this.state.callsNotificationSound || 'default'}
|
||||||
isCollapsedThreadsEnabled={this.props.isCollapsedThreadsEnabled}
|
isCollapsedThreadsEnabled={this.props.isCollapsedThreadsEnabled}
|
||||||
areAllSectionsInactive={this.props.activeSection === ''}
|
areAllSectionsInactive={this.props.activeSection === ''}
|
||||||
isCallsEnabled={this.props.isCallsEnabled}
|
isCallsRingingEnabled={this.props.isCallsRingingEnabled}
|
||||||
/>
|
/>
|
||||||
<div className='divider-light'/>
|
<div className='divider-light'/>
|
||||||
<EmailNotificationSetting
|
<EmailNotificationSetting
|
||||||
|
@ -6,6 +6,12 @@ import {suitePluginIds} from 'utils/constants';
|
|||||||
import semver from 'semver';
|
import semver from 'semver';
|
||||||
|
|
||||||
export function isCallsEnabled(state: GlobalState, minVersion = '0.4.2') {
|
export function isCallsEnabled(state: GlobalState, minVersion = '0.4.2') {
|
||||||
return state.plugins.plugins[suitePluginIds.calls] &&
|
return Boolean(state.plugins.plugins[suitePluginIds.calls] &&
|
||||||
semver.gte(state.plugins.plugins[suitePluginIds.calls].version || '0.0.0', minVersion);
|
semver.gte(state.plugins.plugins[suitePluginIds.calls].version || '0.0.0', minVersion));
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isCallsRingingEnabled(state: GlobalState) {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
|
// @ts-ignore
|
||||||
|
return Boolean(state[`plugins-${suitePluginIds.calls}`]?.callsConfig?.EnableRinging);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user