1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-26 17:03:12 +03:00

Stop encrypting redactions as it isn't spec compliant (#2098)

This commit is contained in:
Michael Telatynski
2022-01-10 17:02:11 +00:00
committed by GitHub
parent 83d952eae8
commit 5da562fa6f
3 changed files with 140 additions and 10 deletions

View File

@@ -3726,6 +3726,12 @@ export class MatrixClient extends EventEmitter {
return null;
}
if (event.isRedaction()) {
// Redactions do not support encryption in the spec at this time,
// whilst it mostly worked in some clients, it wasn't compliant.
return null;
}
if (!this.isRoomEncrypted(event.getRoomId())) {
return null;
}
@@ -3852,7 +3858,7 @@ export class MatrixClient extends EventEmitter {
txnId?: string | Callback | IRedactOpts,
cbOrOpts?: Callback | IRedactOpts,
): Promise<ISendEventResponse> {
if (!eventId || eventId.startsWith(EVENT_ID_PREFIX)) {
if (!eventId?.startsWith(EVENT_ID_PREFIX)) {
cbOrOpts = txnId as (Callback | IRedactOpts);
txnId = eventId;
eventId = threadId;
@@ -3863,7 +3869,7 @@ export class MatrixClient extends EventEmitter {
const callback = typeof (cbOrOpts) === 'function' ? cbOrOpts : undefined;
return this.sendCompleteEvent(roomId, threadId, {
type: EventType.RoomRedaction,
content: { reason: reason },
content: { reason },
redacts: eventId,
}, txnId as string, callback);
}