mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-11 18:32:20 +08:00
c404b19b33
Summary: fix(attachment): Bad filenames breaking icons fix developer bar colors fix critical bug with files Render small attachments inline-block, without hover effect, and with nice dotted transparency background Test Plan: No new tests Reviewers: evan Reviewed By: evan Differential Revision: https://phab.nylas.com/D1661
55 lines
1.5 KiB
CoffeeScript
55 lines
1.5 KiB
CoffeeScript
_ = require 'underscore'
|
|
React = require 'react'
|
|
{Actions,
|
|
Utils,
|
|
Thread,
|
|
AddRemoveTagsTask,
|
|
NamespaceStore} = 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.hasTagId('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]
|
|
|
|
myEmail = NamespaceStore.current()?.emailAddress
|
|
if msgs.length > 1 and last.from[0]?.email is myEmail
|
|
if Utils.isForwardedMessage(last)
|
|
return 'thread-icon-forwarded thread-icon-star-on-hover'
|
|
else
|
|
return 'thread-icon-replied thread-icon-star-on-hover'
|
|
|
|
return 'thread-icon-star-on-hover'
|
|
|
|
_nonDraftMessages: =>
|
|
msgs = @props.thread.metadata
|
|
return [] unless msgs and msgs instanceof Array
|
|
msgs = _.filter msgs, (m) -> m.isSaved() and not m.draft
|
|
return msgs
|
|
|
|
render: =>
|
|
<div className="thread-icon #{@_iconType()}" onClick={@_onToggleStar}></div>
|
|
|
|
_onToggleStar: (event) =>
|
|
if @props.thread.hasTagId('starred')
|
|
star = new AddRemoveTagsTask(@props.thread, [], ['starred'])
|
|
else
|
|
star = new AddRemoveTagsTask(@props.thread, ['starred'], [])
|
|
Actions.queueTask(star)
|
|
|
|
# Don't trigger the thread row click
|
|
event.stopPropagation()
|
|
|
|
module.exports = ThreadListIcon
|