fix(thread-list): Use hasAttachments flag, fix bug where attachments icon did not appear in search results

This commit is contained in:
Ben Gotow 2015-09-23 15:48:03 -07:00
parent 3c26f1cba0
commit f62fe26524
3 changed files with 7 additions and 7 deletions

View file

@ -104,8 +104,7 @@ class ThreadList extends React.Component
resolver: (thread) => resolver: (thread) =>
attachment = [] attachment = []
labels = [] labels = []
hasAttachments = _.find (thread.metadata ? []), (m) -> m.files.length > 0 if thread.hasAttachments
if hasAttachments
attachment = <div className="thread-icon thread-icon-attachment"></div> attachment = <div className="thread-icon thread-icon-attachment"></div>
currentCategoryId = FocusedMailViewStore.mailView()?.categoryId() currentCategoryId = FocusedMailViewStore.mailView()?.categoryId()
@ -146,13 +145,11 @@ class ThreadList extends React.Component
pencil = [] pencil = []
attachment = [] attachment = []
hasDraft = _.find (thread.metadata ? []), (m) -> m.draft hasDraft = _.find (thread.metadata ? []), (m) -> m.draft
hasAttachments = _.find (thread.metadata ? []), (m) -> m.files.length > 0 if thread.hasAttachments
attachment = <div className="thread-icon thread-icon-attachment"></div>
if hasDraft if hasDraft
pencil = <RetinaImg name="icon-draft-pencil.png" className="draft-icon" mode={RetinaImg.Mode.ContentPreserve} /> pencil = <RetinaImg name="icon-draft-pencil.png" className="draft-icon" mode={RetinaImg.Mode.ContentPreserve} />
if hasAttachments
attachment = <div className="thread-icon thread-icon-attachment"></div>
<div> <div>
<div style={display: 'flex'}> <div style={display: 'flex'}>
<ThreadListIcon thread={thread} /> <ThreadListIcon thread={thread} />

View file

@ -22,7 +22,7 @@ class MenuItem extends React.Component
- `checked` (optional) Pass a {Boolean} to specify whether the item is checked. - `checked` (optional) Pass a {Boolean} to specify whether the item is checked.
### ###
@propTypes: @propTypes:
divider: React.PropTypes.bool divider: React.PropTypes.string
key: React.PropTypes.string key: React.PropTypes.string
selected: React.PropTypes.bool selected: React.PropTypes.bool
checked: React.PropTypes.bool checked: React.PropTypes.bool

View file

@ -75,6 +75,9 @@ class Thread extends Model
modelKey: 'participants' modelKey: 'participants'
itemClass: Contact itemClass: Contact
'hasAttachments': Attributes.Boolean
modelKey: 'has_attachments'
'lastMessageReceivedTimestamp': Attributes.DateTime 'lastMessageReceivedTimestamp': Attributes.DateTime
queryable: true queryable: true
modelKey: 'lastMessageReceivedTimestamp' modelKey: 'lastMessageReceivedTimestamp'