mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-02-02 05:19:31 +08:00
Add option for unsnoozed messages to show as unread. (#267)
This commit is contained in:
parent
0af31a64c4
commit
614bc198c5
3 changed files with 22 additions and 1 deletions
|
@ -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.
|
||||
|
|
|
@ -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,
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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',
|
||||
|
|
Loading…
Reference in a new issue