From b655c34bbb325a1099ff6538b278cf60d52da254 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Thu, 20 May 2021 13:20:12 +0200 Subject: [PATCH] also show reason for redaction --- src/domain/session/room/timeline/tiles/RedactedTile.js | 8 +++++++- src/matrix/room/timeline/entries/EventEntry.js | 7 +++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/domain/session/room/timeline/tiles/RedactedTile.js b/src/domain/session/room/timeline/tiles/RedactedTile.js index 9349f06e..bf1fc0db 100644 --- a/src/domain/session/room/timeline/tiles/RedactedTile.js +++ b/src/domain/session/room/timeline/tiles/RedactedTile.js @@ -22,6 +22,12 @@ export class RedactedTile extends BaseTextTile { } _getBodyAsString() { - return "This message has been deleted."; + const {redactionReason} = this._entry; + if (redactionReason) { + return this.i18n`This message has been deleted (${redactionReason}).`; + + } else { + return this.i18n`This message has been deleted.`; + } } } diff --git a/src/matrix/room/timeline/entries/EventEntry.js b/src/matrix/room/timeline/entries/EventEntry.js index 561c9f8e..2c30acfb 100644 --- a/src/matrix/room/timeline/entries/EventEntry.js +++ b/src/matrix/room/timeline/entries/EventEntry.js @@ -116,4 +116,11 @@ export class EventEntry extends BaseEntry { get isRedacted() { return !!this._eventEntry.event.unsigned?.redacted_because; } + + get redactionReason() { + const redactionEvent = this._eventEntry.event.unsigned?.redacted_because; + if (redactionEvent) { + return redactionEvent.content?.reason; + } + } } \ No newline at end of file