You've already forked matrix-js-sdk
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:
@@ -431,6 +431,7 @@ MatrixClient.prototype.getCapabilities = function() {
|
|||||||
if (this._cachedCapabilities) {
|
if (this._cachedCapabilities) {
|
||||||
const now = new Date().getTime();
|
const now = new Date().getTime();
|
||||||
if (now - this._cachedCapabilities.lastUpdated <= CAPABILITIES_CACHE_MS) {
|
if (now - this._cachedCapabilities.lastUpdated <= CAPABILITIES_CACHE_MS) {
|
||||||
|
console.log("Returning cached capabilities");
|
||||||
return Promise.resolve(this._cachedCapabilities.capabilities);
|
return Promise.resolve(this._cachedCapabilities.capabilities);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -445,6 +446,8 @@ MatrixClient.prototype.getCapabilities = function() {
|
|||||||
capabilities: capabilities,
|
capabilities: capabilities,
|
||||||
lastUpdated: new Date().getTime(),
|
lastUpdated: new Date().getTime(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
console.log("Caching capabilities: ", capabilities);
|
||||||
return capabilities;
|
return capabilities;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -260,6 +260,8 @@ Room.prototype.getRecommendedVersion = async function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const currentVersion = this.getVersion();
|
const currentVersion = this.getVersion();
|
||||||
|
console.log(`[${this.roomId}] Current version: ${currentVersion}`);
|
||||||
|
console.log(`[${this.roomId}] Version capability: `, versionCap);
|
||||||
|
|
||||||
const result = {
|
const result = {
|
||||||
version: currentVersion,
|
version: currentVersion,
|
||||||
@@ -280,6 +282,11 @@ Room.prototype.getRecommendedVersion = async function() {
|
|||||||
result.version = versionCap.default;
|
result.version = versionCap.default;
|
||||||
result.needsUpgrade = true;
|
result.needsUpgrade = true;
|
||||||
result.urgent = !!this.getVersion().match(/^[0-9]+[0-9.]*$/g);
|
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);
|
return Promise.resolve(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user