diff --git a/src/stores/widgets/StopGapWidget.ts b/src/stores/widgets/StopGapWidget.ts index 3b0a49f81836..c7eae0a57406 100644 --- a/src/stores/widgets/StopGapWidget.ts +++ b/src/stores/widgets/StopGapWidget.ts @@ -221,6 +221,7 @@ export class StopGapWidget extends EventEmitter { clientId: ELEMENT_CLIENT_ID, clientTheme: SettingsStore.getValue("theme"), clientLanguage: getUserLanguage(), + deviceId: this.client.getDeviceId(), }; const templated = this.mockWidget.getCompleteUrl(Object.assign(defaults, fromCustomisation), opts?.asPopout); diff --git a/test/stores/widgets/StopGapWidget-test.ts b/test/stores/widgets/StopGapWidget-test.ts index 38e9983d49bd..da7612a3bf1c 100644 --- a/test/stores/widgets/StopGapWidget-test.ts +++ b/test/stores/widgets/StopGapWidget-test.ts @@ -42,7 +42,7 @@ describe("StopGapWidget", () => { id: "test", creatorUserId: "@alice:example.org", type: "example", - url: "https://example.org", + url: "https://example.org?user-id=$matrix_user_id&device-id=$org.matrix.msc3819.device_id", roomId: "!1:example.org", }, room: mkRoom(client, "!1:example.org"), @@ -60,6 +60,12 @@ describe("StopGapWidget", () => { widget.stopMessaging(); }); + it("should replace parameters in widget url template", () => { + expect(widget.embedUrl).toBe( + "https://example.org/?user-id=%40userId%3Amatrix.org&device-id=ABCDEFGHI&widgetId=test&parentUrl=http%3A%2F%2Flocalhost%2F", + ); + }); + it("feeds incoming to-device messages to the widget", async () => { const event = mkEvent({ event: true,