fix: default mod queue to feed view

This commit is contained in:
Tommaso Casaburi
2026-06-03 18:32:51 +07:00
parent 248ee5b0d5
commit 40bafa2a0f
2 changed files with 10 additions and 4 deletions
@@ -68,6 +68,13 @@ describe('persisted extra stores', () => {
expect(localStorage.getItem('5chan-homepage-stats-scope')).toBe('all'); expect(localStorage.getItem('5chan-homepage-stats-scope')).toBe('all');
}); });
it('defaults the mod queue to feed view when no preference is stored', async () => {
const useModQueueStore = await loadModQueueStore();
await flushMicrotasks();
expect(useModQueueStore.getState().viewMode).toBe('feed');
});
it('migrates legacy mod queue storage and computes threshold seconds from the active unit', async () => { it('migrates legacy mod queue storage and computes threshold seconds from the active unit', async () => {
localStorage.setItem( localStorage.setItem(
'mod-queue-storage', 'mod-queue-storage',
@@ -75,7 +82,6 @@ describe('persisted extra stores', () => {
state: { state: {
alertThresholdHours: 3, alertThresholdHours: 3,
selectedBoardFilter: 'music.eth', selectedBoardFilter: 'music.eth',
viewMode: 'feed',
}, },
version: 0, version: 0,
}), }),
+3 -3
View File
@@ -70,7 +70,7 @@ const useModQueueStore = create<ModQueueState>()(
return { queuedCommentHistory: [...rememberedByCid.values()].slice(0, MAX_QUEUE_HISTORY_COMMENTS) }; return { queuedCommentHistory: [...rememberedByCid.values()].slice(0, MAX_QUEUE_HISTORY_COMMENTS) };
}), }),
selectedBoardFilter: null, selectedBoardFilter: null,
viewMode: 'compact', viewMode: 'feed',
setAlertThreshold: (value, unit) => set({ alertThresholdValue: value, alertThresholdUnit: unit }), setAlertThreshold: (value, unit) => set({ alertThresholdValue: value, alertThresholdUnit: unit }),
setSelectedBoardFilter: (boardAddress) => set({ selectedBoardFilter: boardAddress }), setSelectedBoardFilter: (boardAddress) => set({ selectedBoardFilter: boardAddress }),
setViewMode: (viewMode) => set({ viewMode }), setViewMode: (viewMode) => set({ viewMode }),
@@ -92,7 +92,7 @@ const useModQueueStore = create<ModQueueState>()(
dismissedCommentCids: state.dismissedCommentCids ?? [], dismissedCommentCids: state.dismissedCommentCids ?? [],
queuedCommentHistory: state.queuedCommentHistory ?? [], queuedCommentHistory: state.queuedCommentHistory ?? [],
selectedBoardFilter: state.selectedBoardFilter ?? null, selectedBoardFilter: state.selectedBoardFilter ?? null,
viewMode: state.viewMode ?? 'compact', viewMode: state.viewMode ?? 'feed',
}; };
// Zustand will merge this with the store definition (which includes methods) // Zustand will merge this with the store definition (which includes methods)
return migrated as ModQueueState; return migrated as ModQueueState;
@@ -104,7 +104,7 @@ const useModQueueStore = create<ModQueueState>()(
dismissedCommentCids: state.dismissedCommentCids ?? [], dismissedCommentCids: state.dismissedCommentCids ?? [],
queuedCommentHistory: state.queuedCommentHistory ?? [], queuedCommentHistory: state.queuedCommentHistory ?? [],
selectedBoardFilter: state.selectedBoardFilter ?? null, selectedBoardFilter: state.selectedBoardFilter ?? null,
viewMode: state.viewMode ?? 'compact', viewMode: state.viewMode ?? 'feed',
}; };
return current as ModQueueState; return current as ModQueueState;
}, },