Skip to content

Commit 779afbc

Browse files
author
Germain
authored
Apply redaction logic to threaded events (#2246)
1 parent a3f5ec1 commit 779afbc

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

src/models/room.ts

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1411,6 +1411,7 @@ export class Room extends TypedEventEmitter<EmittedEvents, RoomEventHandlerMap>
14111411
* @experimental
14121412
*/
14131413
public async addThreadedEvent(event: MatrixEvent, toStartOfTimeline: boolean): Promise<void> {
1414+
this.applyRedaction(event);
14141415
let thread = this.findThreadForEvent(event);
14151416
if (thread) {
14161417
thread.addEvent(event, toStartOfTimeline);
@@ -1479,17 +1480,7 @@ export class Room extends TypedEventEmitter<EmittedEvents, RoomEventHandlerMap>
14791480
}
14801481
}
14811482

1482-
/**
1483-
* Add an event to the end of this room's live timelines. Will fire
1484-
* "Room.timeline".
1485-
*
1486-
* @param {MatrixEvent} event Event to be added
1487-
* @param {string?} duplicateStrategy 'ignore' or 'replace'
1488-
* @param {boolean} fromCache whether the sync response came from cache
1489-
* @fires module:client~MatrixClient#event:"Room.timeline"
1490-
* @private
1491-
*/
1492-
private addLiveEvent(event: MatrixEvent, duplicateStrategy?: DuplicateStrategy, fromCache = false): void {
1483+
applyRedaction(event: MatrixEvent): void {
14931484
if (event.isRedaction()) {
14941485
const redactId = event.event.redacts;
14951486

@@ -1533,6 +1524,20 @@ export class Room extends TypedEventEmitter<EmittedEvents, RoomEventHandlerMap>
15331524
// clients can say "so and so redacted an event" if they wish to. Also
15341525
// this may be needed to trigger an update.
15351526
}
1527+
}
1528+
1529+
/**
1530+
* Add an event to the end of this room's live timelines. Will fire
1531+
* "Room.timeline".
1532+
*
1533+
* @param {MatrixEvent} event Event to be added
1534+
* @param {string?} duplicateStrategy 'ignore' or 'replace'
1535+
* @param {boolean} fromCache whether the sync response came from cache
1536+
* @fires module:client~MatrixClient#event:"Room.timeline"
1537+
* @private
1538+
*/
1539+
private addLiveEvent(event: MatrixEvent, duplicateStrategy?: DuplicateStrategy, fromCache = false): void {
1540+
this.applyRedaction(event);
15361541

15371542
// Implement MSC3531: hiding messages.
15381543
if (event.isVisibilityEvent()) {

0 commit comments

Comments
 (0)