also show reason for redaction

This commit is contained in:
Bruno Windels 2021-05-20 13:20:12 +02:00
parent 780ad44032
commit b655c34bbb
2 changed files with 14 additions and 1 deletions

View file

@ -22,6 +22,12 @@ export class RedactedTile extends BaseTextTile {
} }
_getBodyAsString() { _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.`;
}
} }
} }

View file

@ -116,4 +116,11 @@ export class EventEntry extends BaseEntry {
get isRedacted() { get isRedacted() {
return !!this._eventEntry.event.unsigned?.redacted_because; return !!this._eventEntry.event.unsigned?.redacted_because;
} }
get redactionReason() {
const redactionEvent = this._eventEntry.event.unsigned?.redacted_because;
if (redactionEvent) {
return redactionEvent.content?.reason;
}
}
} }