Move RequiresClient from MatrixCapabilities to ElementWidgetCapabilities (#8290)

* Move RequiresClient from MatrixCapabilities to ElementWidgetCapabilities

Signed-off-by: Robin Kouwenhoven <r.kouwenhoven@outlook.com>

* Replace usages of RequiresClient with new location

Signed-off-by: Robin Kouwenhoven <r.kouwenhoven@outlook.com>

Co-authored-by: Travis Ralston <travisr@matrix.org>
This commit is contained in:
Robin Kouwenhoven 2022-04-14 23:25:53 +02:00 committed by GitHub
parent f97572f911
commit aa33442983
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 2 deletions

View file

@ -49,6 +49,7 @@ import WidgetUtils from '../../../utils/WidgetUtils';
import MatrixClientContext from "../../../contexts/MatrixClientContext"; import MatrixClientContext from "../../../contexts/MatrixClientContext";
import { ActionPayload } from "../../../dispatcher/payloads"; import { ActionPayload } from "../../../dispatcher/payloads";
import { Action } from '../../../dispatcher/actions'; import { Action } from '../../../dispatcher/actions';
import { ElementWidgetCapabilities } from '../../../stores/widgets/ElementWidgetCapabilities';
interface IProps { interface IProps {
app: IApp; app: IApp;
@ -430,7 +431,7 @@ export default class AppTile extends React.Component<IProps, IState> {
private onWidgetCapabilitiesNotified = (): void => { private onWidgetCapabilitiesNotified = (): void => {
this.setState({ this.setState({
requiresClient: this.sgWidget.widgetApi.hasCapability(MatrixCapabilities.RequiresClient), requiresClient: this.sgWidget.widgetApi.hasCapability(ElementWidgetCapabilities.RequiresClient),
}); });
}; };

View file

@ -19,4 +19,9 @@ export enum ElementWidgetCapabilities {
* @deprecated Use MSC2931 instead. * @deprecated Use MSC2931 instead.
*/ */
CanChangeViewedRoom = "io.element.view_room", CanChangeViewedRoom = "io.element.view_room",
/**
* Ask Element to not give the option to move the widget into a separate tab.
* This replaces RequiresClient in MatrixCapabilities.
*/
RequiresClient = "io.element.requires_client",
} }

View file

@ -49,6 +49,7 @@ import dis from "../../dispatcher/dispatcher";
import { tryTransformPermalinkToLocalHref } from "../../utils/permalinks/Permalinks"; import { tryTransformPermalinkToLocalHref } from "../../utils/permalinks/Permalinks";
import SettingsStore from "../../settings/SettingsStore"; import SettingsStore from "../../settings/SettingsStore";
import { RoomViewStore } from "../RoomViewStore"; import { RoomViewStore } from "../RoomViewStore";
import { ElementWidgetCapabilities } from "./ElementWidgetCapabilities";
// TODO: Purge this from the universe // TODO: Purge this from the universe
@ -77,7 +78,7 @@ export class StopGapWidgetDriver extends WidgetDriver {
// button if the widget says it supports screenshots. // button if the widget says it supports screenshots.
this.allowedCapabilities = new Set([...allowedCapabilities, this.allowedCapabilities = new Set([...allowedCapabilities,
MatrixCapabilities.Screenshots, MatrixCapabilities.Screenshots,
MatrixCapabilities.RequiresClient]); ElementWidgetCapabilities.RequiresClient]);
// Grant the permissions that are specific to given widget types // Grant the permissions that are specific to given widget types
if (WidgetType.JITSI.matches(this.forWidget.type) && forWidgetKind === WidgetKind.Room) { if (WidgetType.JITSI.matches(this.forWidget.type) && forWidgetKind === WidgetKind.Room) {