1
0

copy sharkey settings into new frontend preferences model

This commit is contained in:
Hazelnoot
2025-03-31 14:53:02 -04:00
parent 59ce4d6c28
commit c371af34e8
50 changed files with 468 additions and 425 deletions
@@ -33,10 +33,10 @@ import { misskeyApi } from '@/utility/misskey-api.js';
import { definePage } from '@/page.js';
import { i18n } from '@/i18n.js';
import { useRouter } from '@/router.js';
import { defaultStore } from '@/store.js';
import { store } from '@/store.js';
import { deepMerge } from '@/utility/merge.js';
import * as os from '@/os.js';
import { $i } from '@/account.js';
import { $i } from '@/i.js';
const router = useRouter();
@@ -50,19 +50,18 @@ const tlEl = useTemplateRef('tlEl');
const rootEl = useTemplateRef('rootEl');
const withRenotes = computed<boolean>({
get: () => defaultStore.reactiveState.tl.value.filter.withRenotes,
get: () => store.r.tl.value.filter.withRenotes,
set: (x) => saveTlFilter('withRenotes', x),
});
const onlyFiles = computed<boolean>({
get: () => defaultStore.reactiveState.tl.value.filter.onlyFiles,
get: () => store.r.tl.value.filter.onlyFiles,
set: (x) => saveTlFilter('onlyFiles', x),
});
function saveTlFilter(key: keyof typeof defaultStore.state.tl.filter, newValue: boolean) {
function saveTlFilter(key: keyof typeof store.s.tl.filter, newValue: boolean) {
if (key !== 'withReplies' || $i) {
const out = deepMerge({ filter: { [key]: newValue } }, defaultStore.state.tl);
defaultStore.set('tl', out);
store.r.tl.value = deepMerge({ filter: { [key]: newValue } }, store.s.tl);
}
}