Daniel
(Daniel Lo Nigro)
March 19, 2021, 10:31pm
19
I submitted a pull request to implement this:
master ← Daniel15:notify-for-folders
opened 10:27PM - 19 Mar 21 UTC
Adds a new dropdown in the account settings to allow notifications to be configu… red for the account:

The options are:
- **Inbox Only**: Current behaviour of only showing notifications for emails in the inbox. This is the default
- **All Folders**: Shows notifications for all folders. Technically this isn't actually "all" as it excludes spam and trash, but it's what users would expect "all" to mean
- **None**: Completely disables notifications of new emails for the account
I'd like to implement per-folder notification settings, but that can come as a followup
This PR solves the following feature requests:
- [Notifications on Non-Inbox Folders](https://community.getmailspring.com/t/notifications-on-non-inbox-folders/323/)
- [Per-account / mailbox notification settings](https://community.getmailspring.com/t/per-account-mailbox-notification-settings/133)
This is still a WIP as:
1. I'm hitting a bug where new emails in folders don't appear until a long time later, even after I do "Sync New Mail Now". Inbox is fine, but folders aren't. I tried waiting ten minutes and doing a sync, and the new emails still didn't appear. However, they do appear after some period of time (unsure as to how long it takes) or when I restartg Mailspring. This is blocking me from fully testing. Related bug report: https://community.getmailspring.com/t/folders-not-updating-until-much-later/943
2. I want to write a unit test for my `shouldNotifyFor` function but I can't figure out how to run the tests in this project - `npm test` just pops up a white screen and throws this error:
```
index.js:26 Error: Could not find a file at path '../../static/jasmine'
at ThemeManager.requireStylesheet (file:///C:/src/Mailspring/app/src/theme-manager.ts:163:13)
at SpecRunner._setupAppEnv (file:///C:/src/Mailspring/app/spec/spec-runner/spec-runner.ts:118:19)
at SpecRunner.runSpecs (file:///C:/src/Mailspring/app/spec/spec-runner/spec-runner.ts:30:10)
at Object.<anonymous> (file:///C:/src/Mailspring/app/spec/spec-runner/spec-bootstrap.ts:15:34)
at Object.<anonymous> (file:///C:/src/Mailspring/app/spec/spec-runner/spec-bootstrap.ts:15:57)
at Module._compile (internal/modules/cjs/loader.js:968:30)
at Object.value [as .ts] (C:\src\Mailspring\app\src\compile-cache.js:145:21)
at Module.load (internal/modules/cjs/loader.js:816:32)
at Module._load (internal/modules/cjs/loader.js:728:14)
at Function.Module._load (electron/js2c/asar.js:748:26)
at Module.require (internal/modules/cjs/loader.js:853:19)
at require (internal/modules/cjs/helpers.js:74:18)
at setupWindow (file:///C:/src/Mailspring/app/static/index.js:47:3)
at window.onload (file:///C:/src/Mailspring/app/static/index.js:75:5)
```
I'm used to Jest tests, but this seems like it uses older Jasmine tests.
However I can’t fully test it as I’m hitting an issue where folders are not properly showing new emails until much later, even if I press “Sync New Mail Now”. Already reported it here:
Description
I have several server-side filters for sorting my incoming emails into various folders.
When I receive new emails to the inbox (not filtered), Mailspring shows them pretty much instantly. However, if I receive new emails into a folder, Mailspring does not show the email as soon as I receive it, even if I’m viewing the folder at that time. I’m sure I got the email as I saw it in another client as well as in a webmail client.
I tried clicking “Sync New Mail Now” and I still didn’t se…