diff --git a/internal_packages/thread-list/lib/thread-list-quick-actions.cjsx b/internal_packages/thread-list/lib/thread-list-quick-actions.cjsx
index a7c728fe8..ab0499a67 100644
--- a/internal_packages/thread-list/lib/thread-list-quick-actions.cjsx
+++ b/internal_packages/thread-list/lib/thread-list-quick-actions.cjsx
@@ -4,19 +4,25 @@ React = require 'react'
Utils,
Thread,
ArchiveThreadHelper,
+ CategoryStore,
+ ChangeFolderTask,
+ ChangeLabelsTask,
NamespaceStore} = require 'nylas-exports'
class ThreadListQuickActions extends React.Component
@displayName: 'ThreadListQuickActions'
@propTypes:
thread: React.PropTypes.object
+ categoryId: React.PropTypes.integer
render: =>
actions = []
actions.push
actions.push
- if not @props.thread.hasCategoryName('archive')
+ if @_shouldDisplayArchiveButton()
actions.push
+ else if NamespaceStore.current().usesLabels() and @props.categoryId == CategoryStore.getStandardCategory('all').id
+ actions.push
{actions}
@@ -25,6 +31,29 @@ class ThreadListQuickActions extends React.Component
shouldComponentUpdate: (newProps, newState) ->
newProps.thread.id isnt @props?.thread.id
+ _shouldDisplayArchiveButton: =>
+ if @props.categoryId != CategoryStore.getStandardCategory('archive')?.id and @props.categoryId != CategoryStore.getStandardCategory('trash')?.id
+ if NamespaceStore.current().usesLabels()
+ if @props.thread.labels.length == 1 and (@props.thread.labels[0].name == "archive" or @props.thread.labels[0].name == "all")
+ return false
+ return true
+ else if @props.thread.folders.length == 1 and @props.thread.folders[0].name == "archive"
+ return false
+ return true
+
+ return false
+
+ _onTrash: (event) =>
+ params = {
+ thread: @props.thread,
+ labelsToRemove: [CategoryStore.byId(@props.categoryId)],
+ labelsToAdd: [CategoryStore.getStandardCategory("trash")]
+ }
+ Actions.queueTask(new ChangeLabelsTask(params))
+ # Don't trigger the thread row click
+ event.stopPropagation()
+
+
_onForward: (event) =>
Actions.composeForward({thread: @props.thread, popout: true})
# Don't trigger the thread row click
@@ -36,8 +65,8 @@ class ThreadListQuickActions extends React.Component
event.stopPropagation()
_onArchive: (event) =>
- task = ArchiveThreadHelper.getArchiveTask([@props.thread])
- Actions.queueTask(task)
+ archiveTask = ArchiveThreadHelper.getArchiveTask([@props.thread])
+ Actions.queueTask(archiveTask)
# Don't trigger the thread row click
event.stopPropagation()
diff --git a/internal_packages/thread-list/lib/thread-list.cjsx b/internal_packages/thread-list/lib/thread-list.cjsx
index 73fab6bfc..bb155fcd6 100644
--- a/internal_packages/thread-list/lib/thread-list.cjsx
+++ b/internal_packages/thread-list/lib/thread-list.cjsx
@@ -116,7 +116,8 @@ class ThreadList extends React.Component
c5 = new ListTabular.Column
name: "HoverActions"
resolver: (thread) =>
-
+ currentCategoryId = FocusedCategoryStore.categoryId()
+
@wideColumns = [c1, c2, c3, c4, c5]
diff --git a/internal_packages/thread-list/stylesheets/thread-list.less b/internal_packages/thread-list/stylesheets/thread-list.less
index 9a02c89b3..7e81a2a4d 100644
--- a/internal_packages/thread-list/stylesheets/thread-list.less
+++ b/internal_packages/thread-list/stylesheets/thread-list.less
@@ -224,6 +224,9 @@
.action.action-archive {
background: url(../static/images/thread-list-quick-actions/ic-quick-button-archive@2x.png) top left no-repeat;
}
+ .action.action-trash {
+ background: url(../static/images/thread-list-quick-actions/ic-quick-button-trash@2x.png) top left no-repeat;
+ }
}
.thread-list .list-item:hover .list-column-HoverActions {
width: 0;
diff --git a/static/images/thread-list-quick-actions/ic-quick-button-trash@2x.png b/static/images/thread-list-quick-actions/ic-quick-button-trash@2x.png
new file mode 100644
index 000000000..ae523d284
Binary files /dev/null and b/static/images/thread-list-quick-actions/ic-quick-button-trash@2x.png differ