mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-14 13:44:41 +08:00
76036e82bd
Summary: - In Gmail all threads /must/ belong to either All Mail, Trash and Spam, and they are mutually exclusive, so we need to make sure that any add/remove label operation still guarantees that constraint - Update ChangeLabelsTask to modify the set of labels to add and remove based on this rule - Update tasksFor archiving, moving to trash and moving to spam so they don't affect any other labels in the thread, as gmail does. - Removing from view /will/ remove any current labels, but will also move between all mail and trash as needed - Remove Inbox, Trash and Spam from the CategoryPicker, as Gmail does Test Plan: - Unit tests Reviewers: drew, evan, bengotow Reviewed By: drew, evan, bengotow Differential Revision: https://phab.nylas.com/D2715
35 lines
996 B
CoffeeScript
35 lines
996 B
CoffeeScript
{RetinaImg} = require 'nylas-component-kit'
|
|
{Actions,
|
|
React,
|
|
TaskFactory,
|
|
DOMUtils,
|
|
AccountStore,
|
|
FocusedPerspectiveStore} = require 'nylas-exports'
|
|
|
|
class ThreadArchiveButton extends React.Component
|
|
@displayName: "ThreadArchiveButton"
|
|
@containerRequired: false
|
|
|
|
@propTypes:
|
|
thread: React.PropTypes.object.isRequired
|
|
|
|
render: =>
|
|
canArchiveThreads = FocusedPerspectiveStore.current().canArchiveThreads([@props.thread])
|
|
return <span /> unless canArchiveThreads
|
|
|
|
<button className="btn btn-toolbar btn-archive"
|
|
style={order: -107}
|
|
title="Archive"
|
|
onClick={@_onArchive}>
|
|
<RetinaImg name="toolbar-archive.png" mode={RetinaImg.Mode.ContentIsMask}/>
|
|
</button>
|
|
|
|
_onArchive: (e) =>
|
|
return unless DOMUtils.nodeIsVisible(e.currentTarget)
|
|
tasks = TaskFactory.tasksForArchiving
|
|
threads: [@props.thread]
|
|
Actions.queueTasks(tasks)
|
|
Actions.popSheet()
|
|
e.stopPropagation()
|
|
|
|
module.exports = ThreadArchiveButton
|