diff --git a/app/internal_packages/preferences/lib/tabs/keymaps/displayed-keybindings.ts b/app/internal_packages/preferences/lib/tabs/keymaps/displayed-keybindings.ts index 4c88f956d..7244f2bc8 100644 --- a/app/internal_packages/preferences/lib/tabs/keymaps/displayed-keybindings.ts +++ b/app/internal_packages/preferences/lib/tabs/keymaps/displayed-keybindings.ts @@ -41,6 +41,7 @@ export default [ ['thread-list:select-unread', localized('Select all unread conversations')], ['thread-list:select-starred', localized('Select all starred conversations')], ['thread-list:select-unstarred', localized('Select all unstarred conversations')], + ['thread-list:select-unread-mark-as-read', localized('Select Unread and Mark as Read')], ], }, { diff --git a/app/internal_packages/thread-list/lib/thread-list.tsx b/app/internal_packages/thread-list/lib/thread-list.tsx index 8c2bede96..7036f5448 100644 --- a/app/internal_packages/thread-list/lib/thread-list.tsx +++ b/app/internal_packages/thread-list/lib/thread-list.tsx @@ -23,6 +23,8 @@ import { FocusedContentStore, FocusedPerspectiveStore, FolderSyncProgressStore, + Thread, + TaskFactory, } from 'mailspring-exports'; import * as ThreadListColumns from './thread-list-columns'; @@ -116,6 +118,7 @@ class ThreadList extends React.Component<{}, { style: string; syncing: boolean } 'thread-list:select-unread': this._onSelectUnread, 'thread-list:select-starred': this._onSelectStarred, 'thread-list:select-unstarred': this._onSelectUnstarred, + 'thread-list:select-unread-mark-as-read': this._onSelectUnreadMarkAsRead, }} onDoubleClick={thread => Actions.popoutThread(thread)} onDragItems={this._onDragItems} @@ -281,6 +284,24 @@ class ThreadList extends React.Component<{}, { style: string; syncing: boolean } const items = dataSource.itemsCurrentlyInViewMatching(item => !item.starred); this.refs.list.handler().onSelect(items); }; + + _onSelectUnreadMarkAsRead = () => { + const dataSource = ThreadListStore.dataSource(); + const items = dataSource.itemsCurrentlyInViewMatching(item => item.unread) as Thread[]; + + if (items.length === 0) { + return; + } + + Actions.queueTask( + TaskFactory.taskForSettingUnread({ + threads: items, + unread: false, + source: 'Toolbar Button: Thread List', + }) + ); + Actions.popSheet(); + }; } export default ThreadList; diff --git a/app/menus/darwin.js b/app/menus/darwin.js index 5d4af3e2b..62632f0c6 100644 --- a/app/menus/darwin.js +++ b/app/menus/darwin.js @@ -73,6 +73,8 @@ module.exports = { { label: localized('Select All Starred'), command: 'thread-list:select-starred' }, { label: localized('Select All Unstarred'), command: 'thread-list:select-unstarred' }, { type: 'separator' }, + { label: localized('Select Unread and Mark as Read'), command: 'thread-list:select-unread-mark-as-read' }, + { type: 'separator' }, { label: localized('Find'), submenu: [ diff --git a/app/menus/linux.js b/app/menus/linux.js index c151b6f72..c30fabd02 100644 --- a/app/menus/linux.js +++ b/app/menus/linux.js @@ -41,6 +41,8 @@ module.exports = { { label: localized('Select All Starred'), command: 'thread-list:select-starred' }, { label: localized('Select All Unstarred'), command: 'thread-list:select-unstarred' }, { type: 'separator' }, + { label: localized('Select Unread and Mark as Read'), command: 'thread-list:select-unread-mark-as-read' }, + { type: 'separator' }, { label: localized('Find'), submenu: [ diff --git a/app/menus/win32.js b/app/menus/win32.js index ed547309d..7a15a2e5c 100644 --- a/app/menus/win32.js +++ b/app/menus/win32.js @@ -20,6 +20,8 @@ module.exports = { { label: localized('Select All Starred'), command: 'thread-list:select-starred' }, { label: localized('Select All Unstarred'), command: 'thread-list:select-unstarred' }, { type: 'separator' }, + { label: localized('Select Unread and Mark as Read'), command: 'thread-list:select-unread-mark-as-read' }, + { type: 'separator' }, { label: localized('Find'), submenu: [