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

Add debugging for spurious room version warnings

See https://github.com/vector-im/riot-web/issues/9225
This commit is contained in:
Travis Ralston
2019-03-20 17:05:09 -06:00
parent 5faf5ea1f8
commit e7c764d5f5
2 changed files with 10 additions and 0 deletions

View File

@@ -431,6 +431,7 @@ MatrixClient.prototype.getCapabilities = function() {
if (this._cachedCapabilities) {
const now = new Date().getTime();
if (now - this._cachedCapabilities.lastUpdated <= CAPABILITIES_CACHE_MS) {
console.log("Returning cached capabilities");
return Promise.resolve(this._cachedCapabilities.capabilities);
}
}
@@ -445,6 +446,8 @@ MatrixClient.prototype.getCapabilities = function() {
capabilities: capabilities,
lastUpdated: new Date().getTime(),
};
console.log("Caching capabilities: ", capabilities);
return capabilities;
});
};

View File

@@ -260,6 +260,8 @@ Room.prototype.getRecommendedVersion = async function() {
}
const currentVersion = this.getVersion();
console.log(`[${this.roomId}] Current version: ${currentVersion}`);
console.log(`[${this.roomId}] Version capability: `, versionCap);
const result = {
version: currentVersion,
@@ -280,6 +282,11 @@ Room.prototype.getRecommendedVersion = async function() {
result.version = versionCap.default;
result.needsUpgrade = true;
result.urgent = !!this.getVersion().match(/^[0-9]+[0-9.]*$/g);
if (result.urgent) {
console.warn(`URGENT upgrade required on ${this.roomId}`);
} else {
console.warn(`Non-urgent upgrade required on ${this.roomId}`);
}
return Promise.resolve(result);
}