You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-08-07 21:23:00 +03:00
Migrate broadcast MSC3912 redaction (#11014)
This commit is contained in:
@@ -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<IRedactOpts, "with_rel_types"> = {};
|
||||
|
||||
// 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;
|
||||
|
@@ -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],
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user