Make sure nsfw rooms are always page-loaded as blocked
This commit is contained in:
parent
931cf1cf58
commit
647ebc4f98
|
@ -230,32 +230,38 @@ class RoomDirectoryViewModel extends ViewModel {
|
|||
}
|
||||
|
||||
loadSafeSearchEnabledFromPersistence() {
|
||||
// Safe search is enabled by default and only disabled with the correct 'false' value
|
||||
let safeSearchEnabled = true;
|
||||
|
||||
if (window.localStorage) {
|
||||
const safeSearchEnabledFromPersistence = window.localStorage.getItem(
|
||||
LOCAL_STORAGE_KEYS.safeSearch
|
||||
);
|
||||
|
||||
// Safe search is enabled by default and only disabled with the correct 'false' value
|
||||
let safeSearchEnabled = true;
|
||||
if (safeSearchEnabledFromPersistence === 'false') {
|
||||
safeSearchEnabled = false;
|
||||
}
|
||||
|
||||
this.setSafeSearchEnabled(safeSearchEnabled);
|
||||
return;
|
||||
} else {
|
||||
console.warn(
|
||||
`Skipping \`${LOCAL_STORAGE_KEYS.safeSearch}\` read from LocalStorage since LocalStorage is not available`
|
||||
);
|
||||
}
|
||||
|
||||
this.setSafeSearchEnabled(safeSearchEnabled);
|
||||
}
|
||||
|
||||
setSafeSearchEnabled(safeSearchEnabled) {
|
||||
this._safeSearchEnabled = safeSearchEnabled;
|
||||
if (window.localStorage) {
|
||||
window.localStorage.setItem(
|
||||
LOCAL_STORAGE_KEYS.safeSearch,
|
||||
safeSearchEnabled ? 'true' : 'false'
|
||||
);
|
||||
} else {
|
||||
console.warn(
|
||||
`Skipping \`${LOCAL_STORAGE_KEYS.safeSearch}\` write to LocalStorage since LocalStorage is not available`
|
||||
);
|
||||
}
|
||||
|
||||
if (safeSearchEnabled) {
|
||||
this._roomCardViewModelsFilterMap.setApply((roomId, vm) => {
|
||||
|
|
Loading…
Reference in New Issue