From 9495ba001c95f6b330c582f7b001358d64f31f8f Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Tue, 13 Jul 2021 23:17:17 -0600 Subject: [PATCH 1/3] Send clear events to widgets when permitted Fixes https://github.com/vector-im/element-web/issues/17615 --- src/stores/widgets/StopGapWidget.ts | 2 +- src/stores/widgets/StopGapWidgetDriver.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/stores/widgets/StopGapWidget.ts b/src/stores/widgets/StopGapWidget.ts index 36791d3dd9a..71206470789 100644 --- a/src/stores/widgets/StopGapWidget.ts +++ b/src/stores/widgets/StopGapWidget.ts @@ -415,7 +415,7 @@ export class StopGapWidget extends EventEmitter { private feedEvent(ev: MatrixEvent) { if (!this.messaging) return; - const raw = ev.event as IEvent; + const raw = ev.getClearEvent() as IEvent; this.messaging.feedEvent(raw).catch(e => { console.error("Error sending event to widget: ", e); }); diff --git a/src/stores/widgets/StopGapWidgetDriver.ts b/src/stores/widgets/StopGapWidgetDriver.ts index fd064bae613..5de8a0a361e 100644 --- a/src/stores/widgets/StopGapWidgetDriver.ts +++ b/src/stores/widgets/StopGapWidgetDriver.ts @@ -164,7 +164,7 @@ export class StopGapWidgetDriver extends WidgetDriver { results.push(ev); } - return results.map(e => e.event); + return results.map(e => e.getClearEvent()); } public async readStateEvents(eventType: string, stateKey: string | undefined, limit: number): Promise { From 5dc3d09dd83dd1347a6d59a2cba83e31e35c0112 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Wed, 14 Jul 2021 10:18:55 -0600 Subject: [PATCH 2/3] Use new function name --- src/stores/widgets/StopGapWidget.ts | 2 +- src/stores/widgets/StopGapWidgetDriver.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/stores/widgets/StopGapWidget.ts b/src/stores/widgets/StopGapWidget.ts index 71206470789..830544e7710 100644 --- a/src/stores/widgets/StopGapWidget.ts +++ b/src/stores/widgets/StopGapWidget.ts @@ -415,7 +415,7 @@ export class StopGapWidget extends EventEmitter { private feedEvent(ev: MatrixEvent) { if (!this.messaging) return; - const raw = ev.getClearEvent() as IEvent; + const raw = ev.getEffectiveEvent(); this.messaging.feedEvent(raw).catch(e => { console.error("Error sending event to widget: ", e); }); diff --git a/src/stores/widgets/StopGapWidgetDriver.ts b/src/stores/widgets/StopGapWidgetDriver.ts index 5de8a0a361e..dadedcfe68b 100644 --- a/src/stores/widgets/StopGapWidgetDriver.ts +++ b/src/stores/widgets/StopGapWidgetDriver.ts @@ -164,7 +164,7 @@ export class StopGapWidgetDriver extends WidgetDriver { results.push(ev); } - return results.map(e => e.getClearEvent()); + return results.map(e => e.getEffectiveEvent()); } public async readStateEvents(eventType: string, stateKey: string | undefined, limit: number): Promise { From c4b03064aeee407bb4f41ba6b497f37f12e13533 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Wed, 14 Jul 2021 10:28:45 -0600 Subject: [PATCH 3/3] fix imports --- src/stores/widgets/StopGapWidget.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/stores/widgets/StopGapWidget.ts b/src/stores/widgets/StopGapWidget.ts index 830544e7710..24869b5edc6 100644 --- a/src/stores/widgets/StopGapWidget.ts +++ b/src/stores/widgets/StopGapWidget.ts @@ -51,7 +51,7 @@ import ThemeWatcher from "../../settings/watchers/ThemeWatcher"; import { getCustomTheme } from "../../theme"; import CountlyAnalytics from "../../CountlyAnalytics"; import { ElementWidgetCapabilities } from "./ElementWidgetCapabilities"; -import { MatrixEvent, IEvent } from "matrix-js-sdk/src/models/event"; +import { MatrixEvent } from "matrix-js-sdk/src/models/event"; import { ELEMENT_CLIENT_ID } from "../../identifiers"; import { getUserLanguage } from "../../languageHandler";