correcty load/save `withBots` - fixes #528

there is no `tlWithBots` setting, it's inside `tl.filter` and we need
more complicated code to set it
This commit is contained in:
dakkar 2024-05-18 17:19:17 +01:00
parent 95ec40d3c8
commit 453a023cb9
1 changed files with 9 additions and 1 deletions

View File

@ -293,6 +293,7 @@ import { definePageMetadata } from '@/scripts/page-metadata.js';
import { miLocalStorage } from '@/local-storage.js'; import { miLocalStorage } from '@/local-storage.js';
import { globalEvents } from '@/events.js'; import { globalEvents } from '@/events.js';
import { claimAchievement } from '@/scripts/achievements.js'; import { claimAchievement } from '@/scripts/achievements.js';
import { deepMerge } from '@/scripts/merge.js';
const lang = ref(miLocalStorage.getItem('lang')); const lang = ref(miLocalStorage.getItem('lang'));
const fontSize = ref(miLocalStorage.getItem('fontSize')); const fontSize = ref(miLocalStorage.getItem('fontSize'));
@ -319,7 +320,14 @@ const reactionsDisplaySize = computed(defaultStore.makeGetterSetter('reactionsDi
const limitWidthOfReaction = computed(defaultStore.makeGetterSetter('limitWidthOfReaction')); const limitWidthOfReaction = computed(defaultStore.makeGetterSetter('limitWidthOfReaction'));
const collapseRenotes = computed(defaultStore.makeGetterSetter('collapseRenotes')); const collapseRenotes = computed(defaultStore.makeGetterSetter('collapseRenotes'));
const clickToOpen = computed(defaultStore.makeGetterSetter('clickToOpen')); const clickToOpen = computed(defaultStore.makeGetterSetter('clickToOpen'));
const showBots = computed(defaultStore.makeGetterSetter('tlWithBots')); // copied from src/pages/timeline.vue
const showBots = computed<boolean>({
get: () => defaultStore.reactiveState.tl.value.filter.withBots,
set: (newValue) => {
const out = deepMerge({ filter: { withBots: newValue } }, defaultStore.state.tl);
defaultStore.set('tl', out);
},
});
const collapseFiles = computed(defaultStore.makeGetterSetter('collapseFiles')); const collapseFiles = computed(defaultStore.makeGetterSetter('collapseFiles'));
const autoloadConversation = computed(defaultStore.makeGetterSetter('autoloadConversation')); const autoloadConversation = computed(defaultStore.makeGetterSetter('autoloadConversation'));
const reduceAnimation = computed(defaultStore.makeGetterSetter('animation', v => !v, v => !v)); const reduceAnimation = computed(defaultStore.makeGetterSetter('animation', v => !v, v => !v));