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

Update voice broadcast redaction to use MSC3912 with_rel_type instead of with_relations #11014

Merged
merged 3 commits into from
Jun 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/components/views/dialogs/ConfirmRedactDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -72,7 +72,7 @@ export function createRedactEventDialog({
if (!proceed) return;

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

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

try {
onCloseDialog?.();
await cli.redactEvent(roomId, eventId, undefined, {
...(reason ? { reason } : {}),
...withRelations,
...withRelTypes,
});
} catch (e: any) {
const code = e.errcode || e.statusCode;
Expand Down
6 changes: 3 additions & 3 deletions test/components/views/dialogs/ConfirmRedactDialog-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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, {});
});
});
Expand All @@ -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],
});
});
});
Expand Down