Select Unread and Mark as Read > Mark All as Read #2164

This commit is contained in:
Ben Gotow 2021-02-14 13:50:15 -06:00
parent 99f56a50e6
commit 3b07b0767f
5 changed files with 23 additions and 9 deletions

View file

@ -27,6 +27,7 @@ export default [
['core:mark-as-unread', localized('Mark as %@', localized('Unread'))],
['core:mark-important', localized('Mark as %@', localized('Important')) + ' (Gmail)'],
['core:mark-unimportant', localized('Mark as %@', localized('Not Important')) + ' (Gmail)'],
['thread-list:mark-all-as-read', localized('Mark All as %@', localized('Read'))],
['core:remove-and-previous', localized('Remove and show previous')],
['core:remove-and-next', localized('Remove and show next')],
],
@ -41,7 +42,6 @@ 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

@ -118,7 +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,
'thread-list:mark-all-as-read': this._onMarkAllAsRead,
}}
onDoubleClick={thread => Actions.popoutThread(thread)}
onDragItems={this._onDragItems}
@ -238,10 +238,15 @@ class ThreadList extends React.Component<{}, { style: string; syncing: boolean }
_onDragEnd = event => {};
_onResize = (event?: any) => {
const narrowStyleWidth = DOMUtils.getWorkspaceCssNumberProperty('thread-list-narrow-style-width', 540);
const narrowStyleWidth = DOMUtils.getWorkspaceCssNumberProperty(
'thread-list-narrow-style-width',
540
);
const current = this.state.style;
const desired =
(ReactDOM.findDOMNode(this) as HTMLElement).offsetWidth < narrowStyleWidth ? 'narrow' : 'wide';
(ReactDOM.findDOMNode(this) as HTMLElement).offsetWidth < narrowStyleWidth
? 'narrow'
: 'wide';
if (current !== desired) {
this.setState({ style: desired });
}
@ -285,10 +290,10 @@ class ThreadList extends React.Component<{}, { style: string; syncing: boolean }
this.refs.list.handler().onSelect(items);
};
_onSelectUnreadMarkAsRead = () => {
_onMarkAllAsRead = () => {
const dataSource = ThreadListStore.dataSource();
const items = dataSource.itemsCurrentlyInViewMatching(item => item.unread) as Thread[];
if (items.length === 0) {
return;
}

View file

@ -73,7 +73,10 @@ 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' },
{
label: localized('Mark All as %@', localized('Read')),
command: 'thread-list:mark-all-as-read',
},
{ type: 'separator' },
{
label: localized('Find'),

View file

@ -41,7 +41,10 @@ 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' },
{
label: localized('Mark All as %@', localized('Read')),
command: 'thread-list:mark-all-as-read',
},
{ type: 'separator' },
{
label: localized('Find'),

View file

@ -20,7 +20,10 @@ 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' },
{
label: localized('Mark All as %@', localized('Read')),
command: 'thread-list:mark-all-as-read',
},
{ type: 'separator' },
{
label: localized('Find'),