-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
skip spam email during deriving unread value from local store (2)
* closes #86
- Loading branch information
Showing
4 changed files
with
120 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,21 @@ | ||
import {Folder, MAIL_FOLDER_TYPE, PROTONMAIL_MAILBOX_IDENTIFIERS} from "src/shared/model/database"; | ||
|
||
export const DATABASE_VERSION = "2"; | ||
|
||
export const PROTONMAIL_STATIC_FOLDERS = ([ | ||
[PROTONMAIL_MAILBOX_IDENTIFIERS.Inbox, MAIL_FOLDER_TYPE.INBOX], | ||
[PROTONMAIL_MAILBOX_IDENTIFIERS.Drafts, MAIL_FOLDER_TYPE.DRAFT], | ||
[PROTONMAIL_MAILBOX_IDENTIFIERS.Sent, MAIL_FOLDER_TYPE.SENT], | ||
[PROTONMAIL_MAILBOX_IDENTIFIERS.Starred, MAIL_FOLDER_TYPE.STARRED], | ||
[PROTONMAIL_MAILBOX_IDENTIFIERS.Archive, MAIL_FOLDER_TYPE.ARCHIVE], | ||
[PROTONMAIL_MAILBOX_IDENTIFIERS.Spam, MAIL_FOLDER_TYPE.SPAM], | ||
[PROTONMAIL_MAILBOX_IDENTIFIERS.Trash, MAIL_FOLDER_TYPE.TRASH], | ||
[PROTONMAIL_MAILBOX_IDENTIFIERS["All Mail"], MAIL_FOLDER_TYPE.ALL], | ||
] as Array<[Folder["id"], Folder["folderType"]]>).map(([id, folderType]) => ({ | ||
pk: id, | ||
id, | ||
raw: "{}", | ||
folderType, | ||
name: PROTONMAIL_MAILBOX_IDENTIFIERS._.resolveNameByValue(id as any), | ||
mailFolderId: id, | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import {DbAccountPk, FsDb, FsDbAccount, MemoryDb, MemoryDbAccount} from "src/shared/model/database"; | ||
import {PROTONMAIL_STATIC_FOLDERS} from "./constants"; | ||
|
||
export function resolveFsAccountFolders<T extends keyof FsDb["accounts"]>(account: FsDbAccount<T>) { | ||
return Object.values(account.folders).concat( | ||
resolveAccountVirtualFolders(account.metadata.type), | ||
); | ||
} | ||
|
||
export function resolveMemoryAccountFolders<T extends keyof MemoryDb["accounts"]>(account: MemoryDbAccount<T>) { | ||
return [...account.folders.values()].concat( | ||
resolveAccountVirtualFolders(account.metadata.type), | ||
); | ||
} | ||
|
||
function resolveAccountVirtualFolders<T extends DbAccountPk["type"]>(type: T) { | ||
return type === "protonmail" | ||
? PROTONMAIL_STATIC_FOLDERS | ||
: []; | ||
} |