From 2a1d56a034f0a076bf7abf2c8232a63448a915ea Mon Sep 17 00:00:00 2001 From: vodyanoysh Date: Wed, 15 Apr 2026 22:49:52 +0700 Subject: [PATCH] . --- .../page-2026-04-06T02-01-08-298Z.yml | 0 README.md | 12 +++---- .../src/stores/notifications.store.ts | 32 +++++++++++++++++-- src/renderer/src/stores/settings.store.ts | 2 +- 4 files changed, 36 insertions(+), 10 deletions(-) delete mode 100644 .playwright-mcp/page-2026-04-06T02-01-08-298Z.yml diff --git a/.playwright-mcp/page-2026-04-06T02-01-08-298Z.yml b/.playwright-mcp/page-2026-04-06T02-01-08-298Z.yml deleted file mode 100644 index e69de29..0000000 diff --git a/README.md b/README.md index eeb76ac..88f08fe 100644 --- a/README.md +++ b/README.md @@ -125,12 +125,12 @@ src/ ``` ┌─────────────────────────────────────────────────────┐ │ Main Process (Node.js) │ -│ ┌─────────────────┐ ┌────────────────────────┐ │ -│ │ AccountManager │ │ IPC Handlers │ │ -│ │ providers Map │ │ accounts/folders/ │ │ -│ │ ImapProvider │ │ messages handlers │ │ -│ └────────┬────────┘ └───────────┬────────────┘ │ -└───────────┼───────────────────────┼────────────────┘ +│ ┌─────────────────┐ ┌────────────────────────┐ │ +│ │ AccountManager │ │ IPC Handlers │ │ +│ │ providers Map │ │ accounts/folders/ │ │ +│ │ ImapProvider │ │ messages handlers │ │ +│ └────────┬────────┘ └───────────┬────────────┘ │ +└───────────┼───────────────────────┼─────────────────┘ │ IMAP/SMTP │ ipcMain.handle / webContents.send ▼ ▼ Mail server ┌───────────────┐ diff --git a/src/renderer/src/stores/notifications.store.ts b/src/renderer/src/stores/notifications.store.ts index 82d8775..b3eb3ef 100644 --- a/src/renderer/src/stores/notifications.store.ts +++ b/src/renderer/src/stores/notifications.store.ts @@ -1,5 +1,7 @@ import { ref } from 'vue' import { defineStore } from 'pinia' +import { useFoldersStore } from './folders.store' +import type { Folder } from '@shared/types/folder' const STORAGE_KEY = 'muted-folders' @@ -20,18 +22,42 @@ export const useNotificationsStore = defineStore('notifications', () => { localStorage.setItem(STORAGE_KEY, JSON.stringify(mutedFolders.value)) } - function isMuted(accountId: string, folderId: string): boolean { + function isFolderKeyMuted(accountId: string, folderId: string): boolean { const key = `${accountId}:${folderId}` const expiry = mutedFolders.value[key] if (expiry === undefined) return false - if (expiry === null) return true // forever - if (Date.now() < expiry) return true // not yet expired + if (expiry === null) return true + if (Date.now() < expiry) return true // Expired — clean up lazily delete mutedFolders.value[key] persist() return false } + function findFolderById(folders: Folder[], id: string): Folder | null { + for (const f of folders) { + if (f.id === id) return f + if (f.children.length > 0) { + const found = findFolderById(f.children, id) + if (found) return found + } + } + return null + } + + function isMuted(accountId: string, folderId: string): boolean { + const foldersStore = useFoldersStore() + const allFolders = foldersStore.foldersByAccount[accountId] ?? [] + + let currentId: string | null = folderId + while (currentId !== null) { + if (isFolderKeyMuted(accountId, currentId)) return true + const folder = findFolderById(allFolders, currentId) + currentId = folder?.parentId ?? null + } + return false + } + function muteFolder(accountId: string, folderId: string, durationMs: number | null): void { const key = `${accountId}:${folderId}` mutedFolders.value[key] = durationMs === null ? null : Date.now() + durationMs diff --git a/src/renderer/src/stores/settings.store.ts b/src/renderer/src/stores/settings.store.ts index 9621fb9..e4cf99b 100644 --- a/src/renderer/src/stores/settings.store.ts +++ b/src/renderer/src/stores/settings.store.ts @@ -100,7 +100,7 @@ export const useSettingsStore = defineStore('settings', () => { const swipeLeftAction = ref(saved.swipeLeftAction ?? 'delete') const swipeRightAction = ref(saved.swipeRightAction ?? 'toggleRead') const accentColor = ref(saved.accentColor ?? '#a8e600') - const autoCheckInterval = ref(saved.autoCheckInterval ?? 5) + const autoCheckInterval = ref(saved.autoCheckInterval ?? 1) const uiScale = ref(saved.uiScale ?? 1.0) const downloadFolder = ref(saved.downloadFolder ?? '')