From 7a96f84caba4145c7cce6e380a0404ba166184ee Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Wed, 2 Jun 2021 12:17:09 +0200 Subject: [PATCH] also show redaction reason for redaction local echo --- src/domain/session/room/timeline/tiles/RedactedTile.js | 6 +++++- src/matrix/room/timeline/entries/BaseEventEntry.js | 7 +++++++ src/matrix/room/timeline/entries/EventEntry.js | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/domain/session/room/timeline/tiles/RedactedTile.js b/src/domain/session/room/timeline/tiles/RedactedTile.js index 0026859d..c0da3c92 100644 --- a/src/domain/session/room/timeline/tiles/RedactedTile.js +++ b/src/domain/session/room/timeline/tiles/RedactedTile.js @@ -24,7 +24,11 @@ export class RedactedTile extends BaseMessageTile { get description() { const {redactionReason} = this._entry; if (this.isRedacting) { - return this.i18n`This message is being deleted …`; + if (redactionReason) { + return this.i18n`This message is being deleted (${redactionReason})…`; + } else { + return this.i18n`This message is being deleted…`; + } } else { if (redactionReason) { return this.i18n`This message has been deleted (${redactionReason}).`; diff --git a/src/matrix/room/timeline/entries/BaseEventEntry.js b/src/matrix/room/timeline/entries/BaseEventEntry.js index e474deb4..4bf09ed5 100644 --- a/src/matrix/room/timeline/entries/BaseEventEntry.js +++ b/src/matrix/room/timeline/entries/BaseEventEntry.js @@ -31,6 +31,13 @@ export class BaseEventEntry extends BaseEntry { return this.isRedacting; } + get redactionReason() { + if (this._pendingRedactions) { + return this._pendingRedactions[0].content?.reason; + } + return null; + } + /** aggregates local relation. @return [string] returns the name of the field that has changed, if any diff --git a/src/matrix/room/timeline/entries/EventEntry.js b/src/matrix/room/timeline/entries/EventEntry.js index d3287799..4dbb352f 100644 --- a/src/matrix/room/timeline/entries/EventEntry.js +++ b/src/matrix/room/timeline/entries/EventEntry.js @@ -122,6 +122,6 @@ export class EventEntry extends BaseEventEntry { if (redactionEvent) { return redactionEvent.content?.reason; } - return null; + return super.redactionReason; } } \ No newline at end of file