refactor: store mail flags in sparse relation table

This commit is contained in:
dreamhunter2333
2026-08-27 14:03:50 +08:00
parent 523f9b8af6
commit f12163490e
25 changed files with 750 additions and 179 deletions
+3 -1
View File
@@ -142,7 +142,9 @@ const updateUnreadState = async (mails, state) => {
}
}
const markMailsRead = async (mails) => updateUnreadState(mails, getReadStateValue(false))
const markMailsRead = async (mails) => {
return await updateUnreadState(mails.filter(isMailUnread), getReadStateValue(false))
}
const toggleCurrentMailUnread = async () => {
if (!curMail.value) return
+1 -1
View File
@@ -55,7 +55,7 @@ const fetchMails = async () => {
totalCount.value = count > 0 ? count : totalCount.value;
const rawMail = results && results.length > 0 ? results[0] : null
currentMail.value = rawMail ? await processItem(rawMail) : null
if (openSettings.value.enableMailStates && rawMail) {
if (openSettings.value.enableMailStates && rawMail?.unread) {
const state = getReadStateValue(false)
if (!state) return
const response = await api.fetch(`/api/mails/state`, {