Update globalBlacklistUnverifiedDevices on setting change (#31983)
* fix: Update `globalBlacklistUnverifiedDevices` on setting change Signed-off-by: Skye Elliot <actuallyori@gmail.com> * fix: Use `SettingLevel.DEVICE` filter on blacklisted device watcher * tests: Add playwright test for blacklist unverified devices toggle * docs: Correct test step description Co-authored-by: Andy Balaam <andy.balaam@matrix.org> * tests: Add test for local vs global blacklist unverified devices * tests: Ensure local toggle overrides global toggle. * tests: Add unit tests for blacklistUnverifiedDevices listener --------- Signed-off-by: Skye Elliot <actuallyori@gmail.com> Co-authored-by: Andy Balaam <andy.balaam@matrix.org>
This commit is contained in:
co-authored by
Andy Balaam
parent
81b111371f
commit
f6352afc6e
@@ -1793,8 +1793,20 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
||||
|
||||
const crypto = cli.getCrypto();
|
||||
if (crypto) {
|
||||
const blacklistEnabled = SettingsStore.getValueAt(SettingLevel.DEVICE, "blacklistUnverifiedDevices");
|
||||
crypto.globalBlacklistUnverifiedDevices = blacklistEnabled;
|
||||
crypto.globalBlacklistUnverifiedDevices = SettingsStore.getValueAt(
|
||||
SettingLevel.DEVICE,
|
||||
"blacklistUnverifiedDevices",
|
||||
);
|
||||
SettingsStore.watchSetting(
|
||||
"blacklistUnverifiedDevices",
|
||||
null,
|
||||
(_settingName, _roomId, atLevel, blacklistEnabled: boolean) => {
|
||||
if (atLevel != SettingLevel.DEVICE) {
|
||||
return;
|
||||
}
|
||||
crypto.globalBlacklistUnverifiedDevices = blacklistEnabled;
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
// Cannot be done in OnLoggedIn as at that point the AccountSettingsHandler doesn't yet have a client
|
||||
|
||||
Reference in New Issue
Block a user