diff --git a/app/internal_packages/thread-snooze/lib/snooze-store.es6 b/app/internal_packages/thread-snooze/lib/snooze-store.es6 index c0c980cd4..ae4cf1b66 100644 --- a/app/internal_packages/thread-snooze/lib/snooze-store.es6 +++ b/app/internal_packages/thread-snooze/lib/snooze-store.es6 @@ -8,7 +8,7 @@ import { Thread, } from 'mailspring-exports'; -import { moveThreads, snoozedUntilMessage } from './snooze-utils'; +import { markUnreadIfSet, moveThreads, snoozedUntilMessage } from './snooze-utils'; import { PLUGIN_ID } from './snooze-constants'; import SnoozeActions from './snooze-actions'; @@ -91,6 +91,9 @@ class SnoozeStore extends MailspringStore { // move the threads back to the inbox moveThreads(threads, { snooze: false, description: 'Unsnoozed' }); + // mark the threads unread if setting is enabled + markUnreadIfSet(threads, 'Unsnoozed message'); + // remove the expiration on the metadata. note this is super important, // otherwise we'll receive a notification from the sync worker over and // over again. diff --git a/app/internal_packages/thread-snooze/lib/snooze-utils.es6 b/app/internal_packages/thread-snooze/lib/snooze-utils.es6 index 3c7a970c2..68b97f52d 100644 --- a/app/internal_packages/thread-snooze/lib/snooze-utils.es6 +++ b/app/internal_packages/thread-snooze/lib/snooze-utils.es6 @@ -52,3 +52,16 @@ export function moveThreads(threads, { snooze, description } = {}) { Actions.queueTasks(tasks); } + +export function markUnreadIfSet(threads, source) { + if (AppEnv.config.get('core.notifications.unreadOnSnooze')) { + Actions.queueTask( + TaskFactory.taskForSettingUnread({ + unread: true, + threads: threads, + source: source, + canBeUndone: true, + }) + ); + } +} diff --git a/app/src/config-schema.es6 b/app/src/config-schema.es6 index 01779c9cb..01c65dee8 100644 --- a/app/src/config-schema.es6 +++ b/app/src/config-schema.es6 @@ -158,6 +158,11 @@ export default { default: true, title: 'Play sound when receiving new mail', }, + unreadOnSnooze: { + type: 'boolean', + default: false, + title: 'Mark a message unread when returning from snooze', + }, countBadge: { type: 'string', default: 'unread',