You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-08-07 23:02:56 +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);
|
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.
|
// The global value is treated as a default for when rooms don't specify a value.
|
||||||
let isBlacklisting = this.crypto.getGlobalBlacklistUnverifiedDevices();
|
let isBlacklisting = this.crypto.getGlobalBlacklistUnverifiedDevices();
|
||||||
if (typeof room.getBlacklistUnverifiedDevices() === 'boolean') {
|
const isRoomBlacklisting = room.getBlacklistUnverifiedDevices();
|
||||||
isBlacklisting = room.getBlacklistUnverifiedDevices();
|
if (typeof isRoomBlacklisting === 'boolean') {
|
||||||
|
isBlacklisting = isRoomBlacklisting;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We are happy to use a cached version here: we assume that if we already
|
// 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
|
* @return {Boolean} true if blacklisting unverified devices, null
|
||||||
* if the global value should be used for this room.
|
* if the global value should be used for this room.
|
||||||
*/
|
*/
|
||||||
public getBlacklistUnverifiedDevices(): boolean {
|
public getBlacklistUnverifiedDevices(): boolean | null {
|
||||||
return !!this.blacklistUnverifiedDevices;
|
if (this.blacklistUnverifiedDevices === undefined) return null;
|
||||||
|
return this.blacklistUnverifiedDevices;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user