Skip to content

Commit

Permalink
Don't decrement the length count of a thread when root redacted
Browse files Browse the repository at this point in the history
The count is number of replies, in which the root is not included
  • Loading branch information
t3chguy committed Apr 21, 2022
1 parent c0cb662 commit bc01560
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/models/thread.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ export class Thread extends TypedEventEmitter<EmittedEvents, EventHandlerMap> {
private onBeforeRedaction = (event: MatrixEvent, redaction: MatrixEvent) => {
if (event?.isRelation(THREAD_RELATION_TYPE.name) &&
this.room.eventShouldLiveIn(event).threadId === this.id &&
event.getId() !== this.id && // the root event isn't counted in the length so ignore this redaction
!redaction.status // only respect it when it succeeds
) {
this.replyCount--;
Expand Down

0 comments on commit bc01560

Please sign in to comment.