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

Commit 1091e14

Browse files
authored
Migrate broadcast MSC3912 redaction (#11014)
1 parent 4c73903 commit 1091e14

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/components/views/dialogs/ConfirmRedactDialog.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ limitations under the License.
1515
*/
1616

1717
import { Feature, ServerSupport } from "matrix-js-sdk/src/feature";
18-
import { MatrixEvent, RelationType } from "matrix-js-sdk/src/matrix";
18+
import { IRedactOpts, MatrixEvent, RelationType } from "matrix-js-sdk/src/matrix";
1919
import React from "react";
2020

2121
import { _t } from "../../../languageHandler";
@@ -72,7 +72,7 @@ export function createRedactEventDialog({
7272
if (!proceed) return;
7373

7474
const cli = MatrixClientPeg.get();
75-
const withRelations: { with_relations?: RelationType[] } = {};
75+
const withRelTypes: Pick<IRedactOpts, "with_rel_types"> = {};
7676

7777
// redact related events if this is a voice broadcast started event and
7878
// server has support for relation based redactions
@@ -82,15 +82,15 @@ export function createRedactEventDialog({
8282
relationBasedRedactionsSupport &&
8383
relationBasedRedactionsSupport !== ServerSupport.Unsupported
8484
) {
85-
withRelations.with_relations = [RelationType.Reference];
85+
withRelTypes.with_rel_types = [RelationType.Reference];
8686
}
8787
}
8888

8989
try {
9090
onCloseDialog?.();
9191
await cli.redactEvent(roomId, eventId, undefined, {
9292
...(reason ? { reason } : {}),
93-
...withRelations,
93+
...withRelTypes,
9494
});
9595
} catch (e: any) {
9696
const code = e.errcode || e.statusCode;

test/components/views/dialogs/ConfirmRedactDialog-test.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ describe("ConfirmRedactDialog", () => {
9494
await confirmDeleteVoiceBroadcastStartedEvent();
9595
});
9696

97-
it("should call redact without `with_relations`", () => {
97+
it("should call redact without `with_rel_types`", () => {
9898
expect(client.redactEvent).toHaveBeenCalledWith(roomId, mxEvent.getId(), undefined, {});
9999
});
100100
});
@@ -110,9 +110,9 @@ describe("ConfirmRedactDialog", () => {
110110
await confirmDeleteVoiceBroadcastStartedEvent();
111111
});
112112

113-
it("should call redact with `with_relations`", () => {
113+
it("should call redact with `with_rel_types`", () => {
114114
expect(client.redactEvent).toHaveBeenCalledWith(roomId, mxEvent.getId(), undefined, {
115-
with_relations: [RelationType.Reference],
115+
with_rel_types: [RelationType.Reference],
116116
});
117117
});
118118
});

0 commit comments

Comments
 (0)