1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-25 05:23:13 +03:00

Out of sync thread summary in main timeline (#2153)

This commit is contained in:
Germain
2022-02-04 11:57:42 +00:00
committed by GitHub
parent b07457726b
commit 7faff66006
3 changed files with 23 additions and 7 deletions

View File

@@ -277,7 +277,7 @@ export class MatrixEvent extends EventEmitter {
* it to us and the time we're now constructing this event, but that's better
* than assuming the local clock is in sync with the origin HS's clock.
*/
public readonly localTimestamp: number;
public localTimestamp: number;
// XXX: these should be read-only
public sender: RoomMember = null;
@@ -342,7 +342,7 @@ export class MatrixEvent extends EventEmitter {
});
this.txnId = event.txn_id || null;
this.localTimestamp = Date.now() - this.getAge();
this.localTimestamp = Date.now() - (this.getAge() ?? 0);
this.reEmitter = new ReEmitter(this);
}
@@ -584,9 +584,10 @@ export class MatrixEvent extends EventEmitter {
* Get the age of this event. This represents the age of the event when the
* event arrived at the device, and not the age of the event when this
* function was called.
* @return {Number} The age of this event in milliseconds.
* Can only be returned once the server has echo'ed back
* @return {Number|undefined} The age of this event in milliseconds.
*/
public getAge(): number {
public getAge(): number | undefined {
return this.getUnsigned().age || this.event.age; // v2 / v1
}
@@ -1269,6 +1270,8 @@ export class MatrixEvent extends EventEmitter {
// emit the event if it changed
this.emit("Event.localEventIdReplaced", this);
}
this.localTimestamp = Date.now() - this.getAge();
}
/**