You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2026-01-03 23:22:30 +03:00
add method to room to check for unverified devices
This commit is contained in:
@@ -589,6 +589,24 @@ Room.prototype._fixUpLegacyTimelineFields = function() {
|
||||
.getState(EventTimeline.FORWARDS);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns whether there are any devices in the room that are unverified
|
||||
* @return {bool} the result
|
||||
*/
|
||||
Room.prototype.hasUnverifiedDevices = async function() {
|
||||
if (!this._client.isRoomEncrypted(this.roomId)) {
|
||||
return false;
|
||||
}
|
||||
const memberIds = Object.keys(this.currentState.members);
|
||||
for (const userId of memberIds) {
|
||||
const devices = await this._client.getStoredDevicesForUser(userId);
|
||||
if (devices.some((device) => device.isUnverified())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Return the timeline sets for this room.
|
||||
* @return {EventTimelineSet[]} array of timeline sets for this room
|
||||
|
||||
Reference in New Issue
Block a user