React = require 'react' {Actions, CategoryStore, TaskFactory, AccountStore, FocusedPerspectiveStore} = require 'nylas-exports' class ThreadArchiveQuickAction extends React.Component @displayName: 'ThreadArchiveQuickAction' @propTypes: thread: React.PropTypes.object render: => allowed = FocusedPerspectiveStore.current().canArchiveThreads([@props.thread]) return unless allowed
shouldComponentUpdate: (newProps, newState) -> newProps.thread.id isnt @props?.thread.id _onArchive: (event) => tasks = TaskFactory.tasksForArchiving source: "Quick Actions: Thread List" threads: [@props.thread] Actions.queueTasks(tasks) class ThreadTrashQuickAction extends React.Component @displayName: 'ThreadTrashQuickAction' @propTypes: thread: React.PropTypes.object render: => allowed = FocusedPerspectiveStore.current().canMoveThreadsTo([@props.thread], 'trash') return unless allowed
shouldComponentUpdate: (newProps, newState) -> newProps.thread.id isnt @props?.thread.id _onRemove: (event) => Actions.trashThreads({ source: "Quick Actions: Thread List", threads: [@props.thread], }) # Don't trigger the thread row click event.stopPropagation() module.exports = { ThreadArchiveQuickAction, ThreadTrashQuickAction }