From 4e4ce65f584ba3c760c97d47fe971bde12800731 Mon Sep 17 00:00:00 2001 From: Germain Date: Thu, 17 Mar 2022 17:38:29 +0000 Subject: [PATCH] Use redaction enum event type rather than hardcoded string (#8071) --- .../views/dialogs/MessageEditHistoryDialog.tsx | 2 +- test/utils/export-test.tsx | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/components/views/dialogs/MessageEditHistoryDialog.tsx b/src/components/views/dialogs/MessageEditHistoryDialog.tsx index 005f77b05f..2a9e02cc04 100644 --- a/src/components/views/dialogs/MessageEditHistoryDialog.tsx +++ b/src/components/views/dialogs/MessageEditHistoryDialog.tsx @@ -107,7 +107,7 @@ export default class MessageEditHistoryDialog extends React.PureComponent { - return pe.getType() === "m.room.redaction" && pe.getAssociatedId() === e.getId(); + return pe.getType() === EventType.RoomRedaction && pe.getAssociatedId() === e.getId(); }); if (pendingRedaction) { e.markLocallyRedacted(pendingRedaction); diff --git a/test/utils/export-test.tsx b/test/utils/export-test.tsx index 48c72bc763..f385df5c2a 100644 --- a/test/utils/export-test.tsx +++ b/test/utils/export-test.tsx @@ -15,7 +15,15 @@ limitations under the License. */ import { renderToString } from "react-dom/server"; -import { IContent, MatrixClient, MatrixEvent, Room, RoomMember, RelationType } from "matrix-js-sdk/src/matrix"; +import { + IContent, + MatrixClient, + MatrixEvent, + Room, + RoomMember, + RelationType, + EventType, +} from "matrix-js-sdk/src/matrix"; import { MatrixClientPeg } from "../../src/MatrixClientPeg"; import { IExportOptions, ExportType, ExportFormat } from "../../src/utils/exportUtils/exportUtils"; @@ -71,7 +79,7 @@ describe('export', function() { "origin_server_ts": ts0 + i*1000, "redacts": "$9999999999999999999999999999999999999999998", "sender": "@me:here", - "type": "m.room.redaction", + "type": EventType.RoomRedaction, "unsigned": { "age": 94, "transaction_id": "m1111111111.1",