@@ -284,6 +284,11 @@ export class MatrixEvent extends TypedEventEmitter<EmittedEvents, MatrixEventHan
284
284
public error : MatrixError = null ;
285
285
public forwardLooking = true ; // only state events may be backwards looking
286
286
287
+ /* flag to indicate that the event was redacted, but we fetched the
288
+ * unredacted content from the server using room moderator powers.
289
+ */
290
+ public viewingRedactedContent = false ;
291
+
287
292
/* If the event is a `m.key.verification.request` (or to_device `m.key.verification.start`) event,
288
293
* `Crypto` will set this the `VerificationRequest` for the event
289
294
* so it can be easily accessed from the timeline.
@@ -1142,7 +1147,7 @@ export class MatrixEvent extends TypedEventEmitter<EmittedEvents, MatrixEventHan
1142
1147
* @return {boolean } True if this event has been redacted
1143
1148
*/
1144
1149
public isRedacted ( ) : boolean {
1145
- return Boolean ( this . getUnsigned ( ) . redacted_because ) ;
1150
+ return Boolean ( this . getUnsigned ( ) . redacted_because && ! this . viewingRedactedContent ) ;
1146
1151
}
1147
1152
1148
1153
/**
@@ -1267,6 +1272,19 @@ export class MatrixEvent extends TypedEventEmitter<EmittedEvents, MatrixEventHan
1267
1272
this . localTimestamp = Date . now ( ) - this . getAge ( ) ;
1268
1273
}
1269
1274
1275
+ public showRedactedContent ( event : object ) : void {
1276
+ const oldUnsigned = this . getUnsigned ( ) ;
1277
+ this . event = event ;
1278
+ this . clearEvent = undefined ;
1279
+ if ( ! this . event . unsigned ) {
1280
+ this . event . unsigned = { } ;
1281
+ }
1282
+ this . event . unsigned . redacted_because = oldUnsigned . redacted_because ;
1283
+ this . viewingRedactedContent = true ;
1284
+ this . setStatus ( null ) ;
1285
+ this . localTimestamp = Date . now ( ) - this . getAge ( ) ;
1286
+ }
1287
+
1270
1288
/**
1271
1289
* Whether the event is in any phase of sending, send failure, waiting for
1272
1290
* remote echo, etc.
0 commit comments