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
Fix default behavior of Room.getBlacklistUnverifiedDevices (#2830)
This commit is contained in:
@@ -2926,4 +2926,15 @@ describe("Room", function() {
|
||||
expect(room.getPendingEvent(ev.getId()!)).toBe(ev);
|
||||
}
|
||||
});
|
||||
|
||||
describe("getBlacklistUnverifiedDevices", () => {
|
||||
it("defaults to null", () => {
|
||||
expect(room.getBlacklistUnverifiedDevices()).toBeNull();
|
||||
});
|
||||
|
||||
it("is updated by setBlacklistUnverifiedDevices", () => {
|
||||
room.setBlacklistUnverifiedDevices(false);
|
||||
expect(room.getBlacklistUnverifiedDevices()).toBe(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@@ -1170,8 +1170,9 @@ class MegolmEncryption extends EncryptionAlgorithm {
|
||||
|
||||
// The global value is treated as a default for when rooms don't specify a value.
|
||||
let isBlacklisting = this.crypto.getGlobalBlacklistUnverifiedDevices();
|
||||
if (typeof room.getBlacklistUnverifiedDevices() === 'boolean') {
|
||||
isBlacklisting = room.getBlacklistUnverifiedDevices();
|
||||
const isRoomBlacklisting = room.getBlacklistUnverifiedDevices();
|
||||
if (typeof isRoomBlacklisting === 'boolean') {
|
||||
isBlacklisting = isRoomBlacklisting;
|
||||
}
|
||||
|
||||
// We are happy to use a cached version here: we assume that if we already
|
||||
|
@@ -1325,8 +1325,9 @@ export class Room extends ReadReceipt<RoomEmittedEvents, RoomEventHandlerMap> {
|
||||
* @return {Boolean} true if blacklisting unverified devices, null
|
||||
* if the global value should be used for this room.
|
||||
*/
|
||||
public getBlacklistUnverifiedDevices(): boolean {
|
||||
return !!this.blacklistUnverifiedDevices;
|
||||
public getBlacklistUnverifiedDevices(): boolean | null {
|
||||
if (this.blacklistUnverifiedDevices === undefined) return null;
|
||||
return this.blacklistUnverifiedDevices;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user