You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-08-09 10:22:46 +03:00
Include DeviceInfo in deviceVerificationChanged events
... to help the UI update itself
This commit is contained in:
@@ -418,8 +418,10 @@ function _setDeviceVerification(client, userId, deviceId, verified, blocked, kno
|
|||||||
if (!client._crypto) {
|
if (!client._crypto) {
|
||||||
throw new Error("End-to-End encryption disabled");
|
throw new Error("End-to-End encryption disabled");
|
||||||
}
|
}
|
||||||
client._crypto.setDeviceVerification(userId, deviceId, verified, blocked, known);
|
const dev = client._crypto.setDeviceVerification(
|
||||||
client.emit("deviceVerificationChanged", userId, deviceId);
|
userId, deviceId, verified, blocked, known,
|
||||||
|
);
|
||||||
|
client.emit("deviceVerificationChanged", userId, deviceId, dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -3163,6 +3165,7 @@ module.exports.CRYPTO_ENABLED = CRYPTO_ENABLED;
|
|||||||
* @event module:client~MatrixClient#"deviceVerificationChanged"
|
* @event module:client~MatrixClient#"deviceVerificationChanged"
|
||||||
* @param {string} userId the owner of the verified device
|
* @param {string} userId the owner of the verified device
|
||||||
* @param {string} deviceId the id of the verified device
|
* @param {string} deviceId the id of the verified device
|
||||||
|
* @param {module:crypto/deviceinfo} deviceInfo updated device information
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -386,6 +386,8 @@ Crypto.prototype.listDeviceKeys = function(userId) {
|
|||||||
*
|
*
|
||||||
* @param {?boolean} known whether to mark that the user has been made aware of
|
* @param {?boolean} known whether to mark that the user has been made aware of
|
||||||
* the existence of this device. Null to leave unchanged
|
* the existence of this device. Null to leave unchanged
|
||||||
|
*
|
||||||
|
* @return {module:crypto/deviceinfo} updated DeviceInfo
|
||||||
*/
|
*/
|
||||||
Crypto.prototype.setDeviceVerification = function(userId, deviceId, verified,
|
Crypto.prototype.setDeviceVerification = function(userId, deviceId, verified,
|
||||||
blocked, known) {
|
blocked, known) {
|
||||||
@@ -414,12 +416,12 @@ Crypto.prototype.setDeviceVerification = function(userId, deviceId, verified,
|
|||||||
knownStatus = known;
|
knownStatus = known;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dev.verified === verificationStatus && dev.known === knownStatus) {
|
if (dev.verified !== verificationStatus || dev.known !== knownStatus) {
|
||||||
return;
|
dev.verified = verificationStatus;
|
||||||
|
dev.known = knownStatus;
|
||||||
|
this._sessionStore.storeEndToEndDevicesForUser(userId, devices);
|
||||||
}
|
}
|
||||||
dev.verified = verificationStatus;
|
return DeviceInfo.fromStorage(dev, deviceId);
|
||||||
dev.known = knownStatus;
|
|
||||||
this._sessionStore.storeEndToEndDevicesForUser(userId, devices);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user