mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-09-13 16:14:36 +08:00
[client-app] For consistency, proxy starring thru ThreadListActionStore
Summary: See title Test Plan: Depends on D3990 Reviewers: spang, halla, mark, evan Reviewed By: evan Differential Revision: https://phab.nylas.com/D3991
This commit is contained in:
parent
19195e9686
commit
20f7ae47ca
8 changed files with 17 additions and 16 deletions
|
@ -15,7 +15,6 @@ MessageItemContainer = require './message-item-container'
|
|||
WorkspaceStore,
|
||||
ChangeLabelsTask,
|
||||
ComponentRegistry,
|
||||
ChangeStarredTask,
|
||||
SearchableComponentStore
|
||||
SearchableComponentMaker} = require("nylas-exports")
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
_ = require 'underscore'
|
||||
React = require 'react'
|
||||
{Actions, Utils, ChangeStarredTask} = require 'nylas-exports'
|
||||
{Actions, Utils} = require 'nylas-exports'
|
||||
{RetinaImg} = require 'nylas-component-kit'
|
||||
|
||||
class StarButton extends React.Component
|
||||
|
@ -19,12 +19,10 @@ class StarButton extends React.Component
|
|||
</button>
|
||||
|
||||
_onStarToggle: (e) =>
|
||||
task = new ChangeStarredTask({
|
||||
source: "Toolbar Button: Message List"
|
||||
thread: @props.thread
|
||||
starred: !@props.thread.starred
|
||||
Actions.toggleStarredThreads({
|
||||
source: "Toolbar Button: Message List",
|
||||
threads: [@props.thread]
|
||||
})
|
||||
Actions.queueTask(task)
|
||||
e.stopPropagation()
|
||||
|
||||
|
||||
|
|
|
@ -162,11 +162,10 @@ export default class ThreadListContextMenu {
|
|||
return {
|
||||
label: `${dir}${star}`,
|
||||
click: () => {
|
||||
const task = TaskFactory.taskForInvertingStarred({
|
||||
Actions.toggleStarredThreads({
|
||||
source: "Context Menu: Thread List",
|
||||
threads: this.threads,
|
||||
})
|
||||
Actions.queueTask(task)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,9 +59,7 @@ class ThreadListIcon extends React.Component
|
|||
onClick={@_onToggleStar}></div>
|
||||
|
||||
_onToggleStar: (event) =>
|
||||
task = new ChangeStarredTask(thread: @props.thread, starred: !@props.thread.starred, source: "Thread List Icon")
|
||||
Actions.queueTask(task)
|
||||
|
||||
Actions.toggleStarredThreads(threads: [@props.thread], source: "Thread List Icon")
|
||||
# Don't trigger the thread row click
|
||||
event.stopPropagation()
|
||||
|
||||
|
|
|
@ -256,8 +256,7 @@ class ThreadList extends React.Component
|
|||
_onStarItem: =>
|
||||
threads = @_threadsForKeyboardAction()
|
||||
return unless threads
|
||||
task = TaskFactory.taskForInvertingStarred({threads, source: "Keyboard Shortcut"})
|
||||
Actions.queueTask(task)
|
||||
Actions.toggleStarredThreads({threads, source: "Keyboard Shortcut"})
|
||||
|
||||
_onSnoozeItem: =>
|
||||
disabledPackages = NylasEnv.config.get('core.disabledPackages') ? []
|
||||
|
|
|
@ -165,8 +165,7 @@ export class ToggleStarredButton extends React.Component {
|
|||
};
|
||||
|
||||
_onStar = (event) => {
|
||||
const task = TaskFactory.taskForInvertingStarred({threads: this.props.items, source: "Toolbar Button: Thread List"});
|
||||
Actions.queueTask(task);
|
||||
Actions.toggleStarredThreads({threads: this.props.items, source: "Toolbar Button: Thread List"});
|
||||
event.stopPropagation();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -569,6 +569,7 @@ class Actions {
|
|||
static archiveThreads = ActionScopeWindow;
|
||||
static trashThreads = ActionScopeWindow;
|
||||
static markAsSpamThreads = ActionScopeWindow;
|
||||
static toggleStarredThreads = ActionScopeWindow;
|
||||
static removeThreadsFromView = ActionScopeWindow;
|
||||
static moveThreadsToPerspective = ActionScopeWindow;
|
||||
static applyCategoryToThreads = ActionScopeWindow;
|
||||
|
|
|
@ -20,6 +20,7 @@ class ThreadListActionsStore extends NylasStore {
|
|||
this.listenTo(Actions.archiveThreads, this._onArchiveThreads)
|
||||
this.listenTo(Actions.trashThreads, this._onTrashThreads)
|
||||
this.listenTo(Actions.markAsSpamThreads, this._onMarkAsSpamThreads)
|
||||
this.listenTo(Actions.toggleStarredThreads, this._onToggleStarredThreads)
|
||||
this.listenTo(Actions.removeThreadsFromView, this._onRemoveThreadsFromView)
|
||||
this.listenTo(Actions.moveThreadsToPerspective, this._onMoveThreadsToPerspective)
|
||||
this.listenTo(Actions.removeCategoryFromThreads, this._onRemoveCategoryFromThreads)
|
||||
|
@ -102,6 +103,13 @@ class ThreadListActionsStore extends NylasStore {
|
|||
Actions.queueTasks(tasks)
|
||||
}
|
||||
|
||||
_onToggleStarredThreads = ({threads, source} = {}) => {
|
||||
if (!threads) { return }
|
||||
if (threads.length === 0) { return }
|
||||
const task = TaskFactory.taskForInvertingStarred({threads, source})
|
||||
Actions.queueTask(task)
|
||||
}
|
||||
|
||||
_onRemoveThreadsFromView = ({threads, ruleset, source} = {}) => {
|
||||
if (!threads) { return }
|
||||
if (threads.length === 0) { return }
|
||||
|
|
Loading…
Add table
Reference in a new issue