CalmPref: respect inverted form state

This commit is contained in:
Liam Fitzgerald 2021-07-23 13:38:24 +10:00
parent 133b80e496
commit 3907b96112
No known key found for this signature in database
GPG Key ID: D390E12C61D1CFFB

View File

@ -23,14 +23,14 @@ interface FormSchema {
}
const settingsSel = (s: SettingsState): FormSchema => ({
hideAvatars: s.calm.hideAvatars,
hideNicknames: s.calm.hideNicknames,
hideUnreads: s.calm.hideUnreads,
hideGroups: s.calm.hideGroups,
hideUtilities: s.calm.hideUtilities,
imageShown: !s.remoteContentPolicy.imageShown,
videoShown: !s.remoteContentPolicy.videoShown,
oembedShown: !s.remoteContentPolicy.oembedShown,
hideAvatars: s.calm.hideAvatars,
hideNicknames: s.calm.hideNicknames,
hideUnreads: s.calm.hideUnreads,
hideGroups: s.calm.hideGroups,
hideUtilities: s.calm.hideUtilities,
imageShown: !s.remoteContentPolicy.imageShown,
videoShown: !s.remoteContentPolicy.videoShown,
oembedShown: !s.remoteContentPolicy.oembedShown,
audioShown: !s.remoteContentPolicy.audioShown
});
@ -42,7 +42,7 @@ export function CalmPrefs() {
_.forEach(v, (bool, key) => {
const bucket = ['imageShown', 'videoShown', 'audioShown', 'oembedShown'].includes(key) ? 'remoteContentPolicy' : 'calm';
if(initialValues[key] !== bool) {
putEntry(bucket, key, bool);
putEntry(bucket, key, bucket === 'calm' ? bool : !bool);
}
});
}, [initialValues]);