1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-12-04 05:02:41 +03:00

Fix threads reply count sometimes off by one (#2240)

This commit is contained in:
Germain
2022-03-16 00:59:12 +00:00
committed by GitHub
parent ee9eccb85a
commit 42b3b73551

View File

@@ -191,7 +191,10 @@ export class Thread extends TypedEventEmitter<EmittedEvents, EventHandlerMap> {
// There is a risk that the `localTimestamp` approximation will not be accurate
// when threads are used over federation. That could results in the reply
// count value drifting away from the value returned by the server
if (!this.lastEvent || (isThreadReply && event.localTimestamp > this.lastEvent.localTimestamp)) {
if (!this.lastEvent || (isThreadReply
&& (event.getId() !== this.lastEvent.getId())
&& (event.localTimestamp > this.lastEvent.localTimestamp))
) {
this.lastEvent = event;
if (this.lastEvent.getId() !== this.id) {
// This counting only works when server side support is enabled