From 7763c5cea79e48709e846226eb9c3f79dbc41fda Mon Sep 17 00:00:00 2001 From: "VL.Y" <1560781+vladimiry@users.noreply.github.com> Date: Tue, 21 Nov 2023 09:01:52 +0300 Subject: [PATCH] take "Almost All Mail" into account in some places --- package.json | 2 +- src/electron-main/database/util.ts | 1 + src/electron-preload/webview/primary/api/index.ts | 6 ++++-- src/shared/model/database/constants.ts | 1 + .../app/_db-view/db-view-mails-search.component.ts | 1 + .../browser-window/app/_db-view/db-view-mails.component.ts | 1 + 6 files changed, 9 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index bb5e2491f..37bef935d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "electron-mail", "description": "Unofficial ProtonMail Desktop App", - "version": "5.2.2", + "version": "5.2.3", "author": "Vladimir Yakovlev ", "license": "GPL-3.0", "homepage": "https://github.com/vladimiry/ElectronMail", diff --git a/src/electron-main/database/util.ts b/src/electron-main/database/util.ts index a7e5f1877..18334e743 100644 --- a/src/electron-main/database/util.ts +++ b/src/electron-main/database/util.ts @@ -39,6 +39,7 @@ const resolveAccountFolders: resolveAccountFoldersType = ( // this folder should not affect the combined "unread" state calculation // so "notify" should be set to 0/disabled since otherwise desktop notifications will always be displayed SYSTEM_FOLDER_IDENTIFIERS["All Mail"], + SYSTEM_FOLDER_IDENTIFIERS["Almost All Mail"], ]; return (account, includingSpam) => [ ...Object.values(account.folders), diff --git a/src/electron-preload/webview/primary/api/index.ts b/src/electron-preload/webview/primary/api/index.ts index 3c3e53fa1..896bacc00 100644 --- a/src/electron-preload/webview/primary/api/index.ts +++ b/src/electron-preload/webview/primary/api/index.ts @@ -63,8 +63,10 @@ export function registerApi(providerApi: ProviderApi): void { {system: [], custom: []}, ); const {id: mailId, conversationEntryPk: conversationId} = input.mail; - const [systemFolderId = systemMailFolderIds[0] /* falling back to first value if no other than "all mail" folder resolved */] - = systemMailFolderIds.filter((id) => id !== SYSTEM_FOLDER_IDENTIFIERS["All Mail"]); + // falling back to first value if no other than "all mail" folder resolved + const [systemFolderId = systemMailFolderIds[0]] = systemMailFolderIds.filter((id) => { + return id !== SYSTEM_FOLDER_IDENTIFIERS["All Mail"] && id !== SYSTEM_FOLDER_IDENTIFIERS["Almost All Mail"]; + }); // TODO resolve "folder.id" value from the folder that contains a minimum items count // so narrowest result if multiple items resolved (so protonmail will have to load less data, pagination thing) const folderId: string | undefined = diff --git a/src/shared/model/database/constants.ts b/src/shared/model/database/constants.ts index f12cca3b5..6322a191b 100644 --- a/src/shared/model/database/constants.ts +++ b/src/shared/model/database/constants.ts @@ -10,6 +10,7 @@ export const SYSTEM_FOLDER_IDENTIFIERS = buildEnumBundle({ Trash: "3", Spam: "4", ["All Mail"]: "5", + ["Almost All Mail"]: "15", Starred: "10", Archive: "6", Sent: "7", diff --git a/src/web/browser-window/app/_db-view/db-view-mails-search.component.ts b/src/web/browser-window/app/_db-view/db-view-mails-search.component.ts index 51344d561..f736d602a 100644 --- a/src/web/browser-window/app/_db-view/db-view-mails-search.component.ts +++ b/src/web/browser-window/app/_db-view/db-view-mails-search.component.ts @@ -98,6 +98,7 @@ export class DbViewMailsSearchComponent extends DbViewAbstractComponent implemen private readonly defaultUncheckedFolderIds: ReadonlySet> = new Set([ SYSTEM_FOLDER_IDENTIFIERS["Virtual Unread"], SYSTEM_FOLDER_IDENTIFIERS["All Mail"], + SYSTEM_FOLDER_IDENTIFIERS["Almost All Mail"], SYSTEM_FOLDER_IDENTIFIERS.Spam, ]); diff --git a/src/web/browser-window/app/_db-view/db-view-mails.component.ts b/src/web/browser-window/app/_db-view/db-view-mails.component.ts index 1ff353f9c..9210f78d1 100644 --- a/src/web/browser-window/app/_db-view/db-view-mails.component.ts +++ b/src/web/browser-window/app/_db-view/db-view-mails.component.ts @@ -159,6 +159,7 @@ export class DbViewMailsComponent extends DbViewAbstractComponent implements OnI SYSTEM_FOLDER_IDENTIFIERS["All Drafts"], SYSTEM_FOLDER_IDENTIFIERS["All Sent"], SYSTEM_FOLDER_IDENTIFIERS["All Mail"], + SYSTEM_FOLDER_IDENTIFIERS["Almost All Mail"], SYSTEM_FOLDER_IDENTIFIERS.Search, SYSTEM_FOLDER_IDENTIFIERS.Label, ]);