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

Check unsigned.age for getAge() for v2. Don't spam SYNCING emissions.

This commit is contained in:
Kegan Dougal
2015-12-14 10:27:53 +00:00
parent 9c49d26525
commit fc6ce20e14
2 changed files with 14 additions and 3 deletions

View File

@@ -143,7 +143,10 @@ module.exports.MatrixEvent.prototype = {
* @return {Number} The age of this event in milliseconds.
*/
getAge: function() {
return this.event.age;
if (this.event.unsigned && this.event.unsigned.age) {
return this.event.unsigned.age; // v2
}
return this.event.age; // v1
},
/**