diff --git a/src/stores/widgets/StopGapWidgetDriver.ts b/src/stores/widgets/StopGapWidgetDriver.ts index b0fe61deb7..18c04ccccc 100644 --- a/src/stores/widgets/StopGapWidgetDriver.ts +++ b/src/stores/widgets/StopGapWidgetDriver.ts @@ -165,6 +165,14 @@ export class StopGapWidgetDriver extends WidgetDriver { WidgetEventCapability.forToDeviceEvent(EventDirection.Receive, eventType).raw, ); } + + // To always allow OIDC requests for element call, the widgetPermissionStore is used: + SdkContextClass.instance.widgetPermissionStore.setOIDCState( + forWidget, + forWidgetKind, + inRoomId, + OIDCState.Allowed, + ); } } diff --git a/test/stores/widgets/WidgetPermissionStore-test.ts b/test/stores/widgets/WidgetPermissionStore-test.ts index d9f1cbb804..97a59834f9 100644 --- a/test/stores/widgets/WidgetPermissionStore-test.ts +++ b/test/stores/widgets/WidgetPermissionStore-test.ts @@ -16,7 +16,7 @@ limitations under the License. import { mocked } from "jest-mock"; import { MatrixClient } from "matrix-js-sdk/src/matrix"; -import { Widget, WidgetKind } from "matrix-widget-api"; +import { MatrixWidgetType, Widget, WidgetKind } from "matrix-widget-api"; import { OIDCState, WidgetPermissionStore } from "../../../src/stores/widgets/WidgetPermissionStore"; import SettingsStore from "../../../src/settings/SettingsStore"; @@ -24,6 +24,7 @@ import { TestSdkContext } from "../../TestSdkContext"; import { SettingLevel } from "../../../src/settings/SettingLevel"; import { SdkContextClass } from "../../../src/contexts/SDKContext"; import { stubClient } from "../../test-utils"; +import { StopGapWidgetDriver } from "../../../src/stores/widgets/StopGapWidgetDriver"; jest.mock("../../../src/settings/SettingsStore"); @@ -38,6 +39,12 @@ describe("WidgetPermissionStore", () => { type: "m.custom", url: "https://invalid.address.here", }); + const elementCallWidget = new Widget({ + id: "group_call", + creatorUserId: "@alice:example.org", + type: MatrixWidgetType.Custom, + url: "https://call.element.io", + }); let settings: Record = {}; // key value store beforeEach(() => { @@ -92,4 +99,10 @@ describe("WidgetPermissionStore", () => { const store2 = context.widgetPermissionStore; expect(store2).toStrictEqual(store); }); + it("auto-approves OIDC requests for element-call", async () => { + new StopGapWidgetDriver([], elementCallWidget, WidgetKind.Room, true, roomId); + expect(widgetPermissionStore.getOIDCState(elementCallWidget, WidgetKind.Room, roomId)).toEqual( + OIDCState.Allowed, + ); + }); });