Able to select all unread and mark as read in one action (#2164)

This commit is contained in:
Vincent Boivin 2021-02-14 14:37:52 -05:00 committed by GitHub
parent 7b80bc6155
commit 99f56a50e6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 28 additions and 0 deletions

View file

@ -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')],
],
},
{

View file

@ -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;

View file

@ -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: [

View file

@ -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: [

View file

@ -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: [