From 3916795f103f9f150341641e927b360fbb4a6c16 Mon Sep 17 00:00:00 2001 From: Michael Weimann Date: Tue, 30 May 2023 16:15:27 +0200 Subject: [PATCH] Migrate broadcast MSC3912 redaction --- src/components/views/dialogs/ConfirmRedactDialog.tsx | 8 ++++---- .../components/views/dialogs/ConfirmRedactDialog-test.tsx | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/views/dialogs/ConfirmRedactDialog.tsx b/src/components/views/dialogs/ConfirmRedactDialog.tsx index cd6ca8119e6..f51b89131c8 100644 --- a/src/components/views/dialogs/ConfirmRedactDialog.tsx +++ b/src/components/views/dialogs/ConfirmRedactDialog.tsx @@ -15,7 +15,7 @@ limitations under the License. */ import { Feature, ServerSupport } from "matrix-js-sdk/src/feature"; -import { MatrixEvent, RelationType } from "matrix-js-sdk/src/matrix"; +import { IRedactOpts, MatrixEvent, RelationType } from "matrix-js-sdk/src/matrix"; import React from "react"; import { _t } from "../../../languageHandler"; @@ -72,7 +72,7 @@ export function createRedactEventDialog({ if (!proceed) return; const cli = MatrixClientPeg.get(); - const withRelations: { with_relations?: RelationType[] } = {}; + const withRelTypes: Pick = {}; // redact related events if this is a voice broadcast started event and // server has support for relation based redactions @@ -82,7 +82,7 @@ export function createRedactEventDialog({ relationBasedRedactionsSupport && relationBasedRedactionsSupport !== ServerSupport.Unsupported ) { - withRelations.with_relations = [RelationType.Reference]; + withRelTypes.with_rel_types = [RelationType.Reference]; } } @@ -90,7 +90,7 @@ export function createRedactEventDialog({ onCloseDialog?.(); await cli.redactEvent(roomId, eventId, undefined, { ...(reason ? { reason } : {}), - ...withRelations, + ...withRelTypes, }); } catch (e: any) { const code = e.errcode || e.statusCode; diff --git a/test/components/views/dialogs/ConfirmRedactDialog-test.tsx b/test/components/views/dialogs/ConfirmRedactDialog-test.tsx index 33fc989966b..57e386cb17c 100644 --- a/test/components/views/dialogs/ConfirmRedactDialog-test.tsx +++ b/test/components/views/dialogs/ConfirmRedactDialog-test.tsx @@ -94,7 +94,7 @@ describe("ConfirmRedactDialog", () => { await confirmDeleteVoiceBroadcastStartedEvent(); }); - it("should call redact without `with_relations`", () => { + it("should call redact without `with_rel_types`", () => { expect(client.redactEvent).toHaveBeenCalledWith(roomId, mxEvent.getId(), undefined, {}); }); }); @@ -110,9 +110,9 @@ describe("ConfirmRedactDialog", () => { await confirmDeleteVoiceBroadcastStartedEvent(); }); - it("should call redact with `with_relations`", () => { + it("should call redact with `with_rel_types`", () => { expect(client.redactEvent).toHaveBeenCalledWith(roomId, mxEvent.getId(), undefined, { - with_relations: [RelationType.Reference], + with_rel_types: [RelationType.Reference], }); }); });