Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Move RequiresClient from MatrixCapabilities to ElementWidgetCapabilit…
Browse files Browse the repository at this point in the history
…ies (#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>
  • Loading branch information
rkouwenhoven and turt2live authored Apr 14, 2022
1 parent f97572f commit aa33442
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/components/views/elements/AppTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ import WidgetUtils from '../../../utils/WidgetUtils';
import MatrixClientContext from "../../../contexts/MatrixClientContext";
import { ActionPayload } from "../../../dispatcher/payloads";
import { Action } from '../../../dispatcher/actions';
import { ElementWidgetCapabilities } from '../../../stores/widgets/ElementWidgetCapabilities';

interface IProps {
app: IApp;
Expand Down Expand Up @@ -430,7 +431,7 @@ export default class AppTile extends React.Component<IProps, IState> {

private onWidgetCapabilitiesNotified = (): void => {
this.setState({
requiresClient: this.sgWidget.widgetApi.hasCapability(MatrixCapabilities.RequiresClient),
requiresClient: this.sgWidget.widgetApi.hasCapability(ElementWidgetCapabilities.RequiresClient),
});
};

Expand Down
5 changes: 5 additions & 0 deletions src/stores/widgets/ElementWidgetCapabilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,9 @@ export enum ElementWidgetCapabilities {
* @deprecated Use MSC2931 instead.
*/
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",
}
3 changes: 2 additions & 1 deletion src/stores/widgets/StopGapWidgetDriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ import dis from "../../dispatcher/dispatcher";
import { tryTransformPermalinkToLocalHref } from "../../utils/permalinks/Permalinks";
import SettingsStore from "../../settings/SettingsStore";
import { RoomViewStore } from "../RoomViewStore";
import { ElementWidgetCapabilities } from "./ElementWidgetCapabilities";

// TODO: Purge this from the universe

Expand Down Expand Up @@ -77,7 +78,7 @@ export class StopGapWidgetDriver extends WidgetDriver {
// button if the widget says it supports screenshots.
this.allowedCapabilities = new Set([...allowedCapabilities,
MatrixCapabilities.Screenshots,
MatrixCapabilities.RequiresClient]);
ElementWidgetCapabilities.RequiresClient]);

// Grant the permissions that are specific to given widget types
if (WidgetType.JITSI.matches(this.forWidget.type) && forWidgetKind === WidgetKind.Room) {
Expand Down

0 comments on commit aa33442

Please sign in to comment.