mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-13 21:24:58 +08:00
a4ee61eadc
Summary: This diff introduces several updates to mail merge to improve the procedure for sending a list of drafts. Specifically, sending mass email will now: - Clear mail merge metadata on the drafts that will actually be sent - Upload attached files only /once/, and reuse those files on the drafts that will actually be sent - Minimize database writes for new drafts being created - Will queue a SendManyDraftsTask that will subsequently queue the necessary SendDraftTasks and keep track of them, and notify of any failed tasks TODO: - Add state to MailMerge plugin for failed sends and ability to attempt to re send them Test Plan: - TODO Reviewers: evan, bengotow, jackie Reviewed By: bengotow, jackie Subscribers: jackie Differential Revision: https://phab.nylas.com/D2973
57 lines
1.5 KiB
CoffeeScript
57 lines
1.5 KiB
CoffeeScript
_ = require 'underscore'
|
|
React = require 'react'
|
|
{DraftHelpers,
|
|
Actions,
|
|
Thread,
|
|
ChangeStarredTask,
|
|
AccountStore} = require 'nylas-exports'
|
|
|
|
class ThreadListIcon extends React.Component
|
|
@displayName: 'ThreadListIcon'
|
|
@propTypes:
|
|
thread: React.PropTypes.object
|
|
|
|
_iconType: =>
|
|
if !@props.thread
|
|
return 'thread-icon-star-on-hover'
|
|
|
|
if @props.thread.starred
|
|
return 'thread-icon-star'
|
|
|
|
if @props.thread.unread
|
|
return 'thread-icon-unread thread-icon-star-on-hover'
|
|
|
|
msgs = @_nonDraftMessages()
|
|
last = msgs[msgs.length - 1]
|
|
|
|
if msgs.length > 1 and last.from[0]?.isMe()
|
|
if DraftHelpers.isForwardedMessage(last)
|
|
return 'thread-icon-forwarded thread-icon-star-on-hover'
|
|
else
|
|
return 'thread-icon-replied thread-icon-star-on-hover'
|
|
|
|
return 'thread-icon-none thread-icon-star-on-hover'
|
|
|
|
_nonDraftMessages: =>
|
|
msgs = @props.thread.metadata
|
|
return [] unless msgs and msgs instanceof Array
|
|
msgs = _.filter msgs, (m) -> m.serverId and not m.draft
|
|
return msgs
|
|
|
|
shouldComponentUpdate: (nextProps) =>
|
|
return false if nextProps.thread is @props.thread
|
|
true
|
|
|
|
render: =>
|
|
<div className="thread-icon #{@_iconType()}"
|
|
title="Star"
|
|
onClick={@_onToggleStar}></div>
|
|
|
|
_onToggleStar: (event) =>
|
|
task = new ChangeStarredTask(thread: @props.thread, starred: !@props.thread.starred)
|
|
Actions.queueTask(task)
|
|
|
|
# Don't trigger the thread row click
|
|
event.stopPropagation()
|
|
|
|
module.exports = ThreadListIcon
|