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

Commit eca8494

Browse files
authored
Merge pull request #8522 from matrix-org/travis/widget-screenshots
Move widget screenshots labs flag to devtools
2 parents d39d332 + b2bf5aa commit eca8494

File tree

4 files changed

+4
-25
lines changed

4 files changed

+4
-25
lines changed

src/components/views/context_menus/WidgetContextMenu.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ const WidgetContextMenu: React.FC<IProps> = ({
110110
}
111111

112112
let snapshotButton;
113-
if (widgetMessaging?.hasCapability(MatrixCapabilities.Screenshots)) {
113+
const screenshotsEnabled = SettingsStore.getValue("enableWidgetScreenshots");
114+
if (screenshotsEnabled && widgetMessaging?.hasCapability(MatrixCapabilities.Screenshots)) {
114115
const onSnapshotClick = () => {
115116
widgetMessaging?.takeScreenshot().then(data => {
116117
dis.dispatch({

src/components/views/dialogs/DevtoolsDialog.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ const DevtoolsDialog: React.FC<IProps> = ({ roomId, onFinished }) => {
101101
<h3>{ _t("Options") }</h3>
102102
<SettingsFlag name="developerMode" level={SettingLevel.ACCOUNT} />
103103
<SettingsFlag name="showHiddenEventsInTimeline" level={SettingLevel.DEVICE} />
104+
<SettingsFlag name="enableWidgetScreenshots" level={SettingLevel.ACCOUNT} />
104105
</div>
105106
</BaseTool>;
106107
}

src/components/views/settings/tabs/user/LabsUserSettingsTab.tsx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,6 @@ export default class LabsUserSettingsTab extends React.Component<{}, IState> {
9292
);
9393
});
9494

95-
groups.getOrCreate(LabGroup.Widgets, []).push(
96-
<SettingsFlag
97-
key="enableWidgetScreenshots"
98-
name="enableWidgetScreenshots"
99-
level={SettingLevel.ACCOUNT}
100-
/>,
101-
);
102-
10395
groups.getOrCreate(LabGroup.Experimental, []).push(
10496
<SettingsFlag
10597
key="lowBandwidth"

src/utils/WidgetUtils.ts

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ limitations under the License.
1717

1818
import * as url from "url";
1919
import { base32 } from "rfc4648";
20-
import { Capability, IWidget, IWidgetData, MatrixCapabilities } from "matrix-widget-api";
20+
import { IWidget, IWidgetData } from "matrix-widget-api";
2121
import { Room } from "matrix-js-sdk/src/models/room";
2222
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
2323
import { logger } from "matrix-js-sdk/src/logger";
@@ -496,21 +496,6 @@ export default class WidgetUtils {
496496
return app as IApp;
497497
}
498498

499-
static getCapWhitelistForAppTypeInRoomId(appType: string, roomId: string): Capability[] {
500-
const enableScreenshots = SettingsStore.getValue("enableWidgetScreenshots", roomId);
501-
502-
const capWhitelist = enableScreenshots ? [MatrixCapabilities.Screenshots] : [];
503-
504-
// Obviously anyone that can add a widget can claim it's a jitsi widget,
505-
// so this doesn't really offer much over the set of domains we load
506-
// widgets from at all, but it probably makes sense for sanity.
507-
if (WidgetType.JITSI.matches(appType)) {
508-
capWhitelist.push(MatrixCapabilities.AlwaysOnScreen);
509-
}
510-
511-
return capWhitelist;
512-
}
513-
514499
static getLocalJitsiWrapperUrl(opts: {forLocalRender?: boolean, auth?: string} = {}) {
515500
// NB. we can't just encodeURIComponent all of these because the $ signs need to be there
516501
const queryStringParts = [

0 commit comments

Comments
 (0)