UI Feature Flag: Disable integrations entry UI

This commit is contained in:
Michael Telatynski 2020-09-16 11:38:50 +01:00
parent 3d9c520af8
commit f4f94e31d1
7 changed files with 32 additions and 12 deletions

View file

@ -44,6 +44,8 @@ import { ViewUserPayload } from "./dispatcher/payloads/ViewUserPayload";
import { Action } from "./dispatcher/actions"; import { Action } from "./dispatcher/actions";
import { EffectiveMembership, getEffectiveMembership, leaveRoomBehaviour } from "./utils/membership"; import { EffectiveMembership, getEffectiveMembership, leaveRoomBehaviour } from "./utils/membership";
import SdkConfig from "./SdkConfig"; import SdkConfig from "./SdkConfig";
import SettingsStore from "./settings/SettingsStore";
import {UIFeature} from "./settings/UIFeature";
// XXX: workaround for https://github.com/microsoft/TypeScript/issues/31816 // XXX: workaround for https://github.com/microsoft/TypeScript/issues/31816
interface HTMLInputEvent extends Event { interface HTMLInputEvent extends Event {
@ -797,6 +799,7 @@ export const Commands = [
command: 'addwidget', command: 'addwidget',
args: '<url | embed code | Jitsi url>', args: '<url | embed code | Jitsi url>',
description: _td('Adds a custom widget by URL to the room'), description: _td('Adds a custom widget by URL to the room'),
isEnabled: () => SettingsStore.getValue(UIFeature.Widgets),
runFn: function(roomId, widgetUrl) { runFn: function(roomId, widgetUrl) {
if (!widgetUrl) { if (!widgetUrl) {
return reject(_t("Please supply a widget URL or embed code")); return reject(_t("Please supply a widget URL or embed code"));

View file

@ -42,6 +42,7 @@ import AccessibleTooltipButton from "../elements/AccessibleTooltipButton";
import WidgetStore, {IApp} from "../../../stores/WidgetStore"; import WidgetStore, {IApp} from "../../../stores/WidgetStore";
import { E2EStatus } from "../../../utils/ShieldUtils"; import { E2EStatus } from "../../../utils/ShieldUtils";
import RoomContext from "../../../contexts/RoomContext"; import RoomContext from "../../../contexts/RoomContext";
import {UIFeature} from "../../../settings/UIFeature";
interface IProps { interface IProps {
room: Room; room: Room;
@ -242,7 +243,7 @@ const RoomSummaryCard: React.FC<IProps> = ({ room, onClose }) => {
</Button> </Button>
</Group> </Group>
<AppsSection room={room} /> { SettingsStore.getValue(UIFeature.Widgets) && <AppsSection room={room} /> }
</BaseCard>; </BaseCard>;
}; };

View file

@ -28,6 +28,7 @@ import RateLimitedFunc from '../../../ratelimitedfunc';
import SettingsStore from "../../../settings/SettingsStore"; import SettingsStore from "../../../settings/SettingsStore";
import AutoHideScrollbar from "../../structures/AutoHideScrollbar"; import AutoHideScrollbar from "../../structures/AutoHideScrollbar";
import CallView from "../voip/CallView"; import CallView from "../voip/CallView";
import {UIFeature} from "../../../settings/UIFeature";
export default class AuxPanel extends React.Component { export default class AuxPanel extends React.Component {
@ -198,18 +199,21 @@ export default class AuxPanel extends React.Component {
/> />
); );
const appsDrawer = <AppsDrawer let appsDrawer;
room={this.props.room} if (SettingsStore.getValue(UIFeature.Widgets)) {
userId={this.props.userId} appsDrawer = <AppsDrawer
maxHeight={this.props.maxHeight} room={this.props.room}
showApps={this.props.showApps} userId={this.props.userId}
hide={this.props.hideAppsDrawer} maxHeight={this.props.maxHeight}
resizeNotifier={this.props.resizeNotifier} showApps={this.props.showApps}
/>; hide={this.props.hideAppsDrawer}
resizeNotifier={this.props.resizeNotifier}
/>;
}
let stateViews = null; let stateViews = null;
if (this.state.counters && SettingsStore.getValue("feature_state_counters")) { if (this.state.counters && SettingsStore.getValue("feature_state_counters")) {
let counters = []; const counters = [];
this.state.counters.forEach((counter, idx) => { this.state.counters.forEach((counter, idx) => {
const title = counter.title; const title = counter.title;
@ -218,7 +222,7 @@ export default class AuxPanel extends React.Component {
const severity = counter.severity; const severity = counter.severity;
const stateKey = counter.stateKey; const stateKey = counter.stateKey;
let span = <span>{ title }: { value }</span> let span = <span>{ title }: { value }</span>;
if (link) { if (link) {
span = ( span = (

View file

@ -31,6 +31,7 @@ import SettingsStore from "../../../settings/SettingsStore";
import {aboveLeftOf, ContextMenu, ContextMenuTooltipButton, useContextMenu} from "../../structures/ContextMenu"; import {aboveLeftOf, ContextMenu, ContextMenuTooltipButton, useContextMenu} from "../../structures/ContextMenu";
import AccessibleTooltipButton from "../elements/AccessibleTooltipButton"; import AccessibleTooltipButton from "../elements/AccessibleTooltipButton";
import ReplyPreview from "./ReplyPreview"; import ReplyPreview from "./ReplyPreview";
import {UIFeature} from "../../../settings/UIFeature";
function ComposerAvatar(props) { function ComposerAvatar(props) {
const MemberStatusMessageAvatar = sdk.getComponent('avatars.MemberStatusMessageAvatar'); const MemberStatusMessageAvatar = sdk.getComponent('avatars.MemberStatusMessageAvatar');
@ -384,9 +385,12 @@ export default class MessageComposer extends React.Component {
permalinkCreator={this.props.permalinkCreator} />, permalinkCreator={this.props.permalinkCreator} />,
<UploadButton key="controls_upload" roomId={this.props.room.roomId} />, <UploadButton key="controls_upload" roomId={this.props.room.roomId} />,
<EmojiButton key="emoji_button" addEmoji={this.addEmoji} />, <EmojiButton key="emoji_button" addEmoji={this.addEmoji} />,
<Stickerpicker key="stickerpicker_controls_button" room={this.props.room} />,
); );
if (SettingsStore.getValue(UIFeature.Widgets)) {
controls.push(<Stickerpicker key="stickerpicker_controls_button" room={this.props.room} />);
}
if (this.state.showCallButtons) { if (this.state.showCallButtons) {
if (callInProgress) { if (callInProgress) {
controls.push( controls.push(

View file

@ -37,6 +37,7 @@ import {abbreviateUrl} from "../../../../../utils/UrlUtils";
import { getThreepidsWithBindStatus } from '../../../../../boundThreepids'; import { getThreepidsWithBindStatus } from '../../../../../boundThreepids';
import Spinner from "../../../elements/Spinner"; import Spinner from "../../../elements/Spinner";
import {SettingLevel} from "../../../../../settings/SettingLevel"; import {SettingLevel} from "../../../../../settings/SettingLevel";
import {UIFeature} from "../../../../../settings/UIFeature";
export default class GeneralUserSettingsTab extends React.Component { export default class GeneralUserSettingsTab extends React.Component {
static propTypes = { static propTypes = {
@ -366,6 +367,8 @@ export default class GeneralUserSettingsTab extends React.Component {
} }
_renderIntegrationManagerSection() { _renderIntegrationManagerSection() {
if (!SettingsStore.getValue(UIFeature.Widgets)) return null;
const SetIntegrationManager = sdk.getComponent("views.settings.SetIntegrationManager"); const SetIntegrationManager = sdk.getComponent("views.settings.SetIntegrationManager");
return ( return (

View file

@ -618,4 +618,8 @@ export const SETTINGS: {[setting: string]: ISetting} = {
supportedLevels: LEVELS_UI_FEATURE, supportedLevels: LEVELS_UI_FEATURE,
default: true, default: true,
}, },
[UIFeature.Widgets]: {
supportedLevels: LEVELS_UI_FEATURE,
default: true,
},
}; };

View file

@ -17,4 +17,5 @@ limitations under the License.
// see settings.md for documentation on conventions // see settings.md for documentation on conventions
export enum UIFeature { export enum UIFeature {
URLPreviews = "UIFeature.urlPreviews", URLPreviews = "UIFeature.urlPreviews",
Widgets = "UIFeature.widgets",
} }