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() {
|
loadSafeSearchEnabledFromPersistence() {
|
||||||
|
// Safe search is enabled by default and only disabled with the correct 'false' value
|
||||||
|
let safeSearchEnabled = true;
|
||||||
|
|
||||||
if (window.localStorage) {
|
if (window.localStorage) {
|
||||||
const safeSearchEnabledFromPersistence = window.localStorage.getItem(
|
const safeSearchEnabledFromPersistence = window.localStorage.getItem(
|
||||||
LOCAL_STORAGE_KEYS.safeSearch
|
LOCAL_STORAGE_KEYS.safeSearch
|
||||||
);
|
);
|
||||||
|
|
||||||
// Safe search is enabled by default and only disabled with the correct 'false' value
|
|
||||||
let safeSearchEnabled = true;
|
|
||||||
if (safeSearchEnabledFromPersistence === 'false') {
|
if (safeSearchEnabledFromPersistence === 'false') {
|
||||||
safeSearchEnabled = false;
|
safeSearchEnabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setSafeSearchEnabled(safeSearchEnabled);
|
|
||||||
return;
|
|
||||||
} else {
|
} else {
|
||||||
console.warn(
|
console.warn(
|
||||||
`Skipping \`${LOCAL_STORAGE_KEYS.safeSearch}\` read from LocalStorage since LocalStorage is not available`
|
`Skipping \`${LOCAL_STORAGE_KEYS.safeSearch}\` read from LocalStorage since LocalStorage is not available`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.setSafeSearchEnabled(safeSearchEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
setSafeSearchEnabled(safeSearchEnabled) {
|
setSafeSearchEnabled(safeSearchEnabled) {
|
||||||
this._safeSearchEnabled = safeSearchEnabled;
|
this._safeSearchEnabled = safeSearchEnabled;
|
||||||
window.localStorage.setItem(
|
if (window.localStorage) {
|
||||||
LOCAL_STORAGE_KEYS.safeSearch,
|
window.localStorage.setItem(
|
||||||
safeSearchEnabled ? 'true' : 'false'
|
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) {
|
if (safeSearchEnabled) {
|
||||||
this._roomCardViewModelsFilterMap.setApply((roomId, vm) => {
|
this._roomCardViewModelsFilterMap.setApply((roomId, vm) => {
|
||||||
|
|
Loading…
Reference in New Issue