mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-09-04 03:34:28 +08:00
fix(attachments): Don't show the paperclip for inline attachments < 3k (signatures, etc.)
This commit is contained in:
parent
78ea5c0c64
commit
bb71529322
3 changed files with 18 additions and 7 deletions
|
@ -54,7 +54,7 @@ class MessageItem extends React.Component
|
|||
|
||||
_renderCollapsed: =>
|
||||
attachmentIcon = []
|
||||
if @props.message.files.length > 0
|
||||
if Utils.showIconForAttachments(@props.message.files)
|
||||
attachmentIcon = <div className="collapsed-attachment"></div>
|
||||
|
||||
<div className={@props.className} onClick={@_toggleCollapsed}>
|
||||
|
|
|
@ -76,8 +76,11 @@ c3 = new ListTabular.Column
|
|||
name: "Message"
|
||||
flex: 4
|
||||
resolver: (thread) =>
|
||||
attachment = []
|
||||
if thread.hasAttachments
|
||||
attachment = false
|
||||
metadata = (thread.metadata ? [])
|
||||
|
||||
hasAttachments = thread.hasAttachments and metadata.find (m) -> Utils.showIconForAttachments(m.files)
|
||||
if hasAttachments
|
||||
attachment = <div className="thread-icon thread-icon-attachment"></div>
|
||||
|
||||
<span className="details">
|
||||
|
@ -114,11 +117,15 @@ cNarrow = new ListTabular.Column
|
|||
name: "Item"
|
||||
flex: 1
|
||||
resolver: (thread) =>
|
||||
pencil = []
|
||||
attachment = []
|
||||
hasDraft = _.find (thread.metadata ? []), (m) -> m.draft
|
||||
if thread.hasAttachments
|
||||
pencil = false
|
||||
attachment = false
|
||||
metadata = (thread.metadata ? [])
|
||||
|
||||
hasAttachments = thread.hasAttachments and metadata.find (m) -> Utils.showIconForAttachments(m.files)
|
||||
if hasAttachments
|
||||
attachment = <div className="thread-icon thread-icon-attachment"></div>
|
||||
|
||||
hasDraft = _.find metadata, (m) -> m.draft
|
||||
if hasDraft
|
||||
pencil = <RetinaImg name="icon-draft-pencil.png" className="draft-icon" mode={RetinaImg.Mode.ContentPreserve} />
|
||||
|
||||
|
|
|
@ -22,6 +22,10 @@ Utils =
|
|||
window.requestAnimationFrame(attempt)
|
||||
attempt()
|
||||
|
||||
showIconForAttachments: (files) ->
|
||||
return false unless files instanceof Array
|
||||
return files.find (f) -> !f.contentId or f.size > 3 * 1024
|
||||
|
||||
extractTextFromHtml: (html, {maxLength} = {}) ->
|
||||
if (html ? "").trim().length is 0 then return ""
|
||||
if maxLength and html.length > maxLength
|
||||
|
|
Loading…
Add table
Reference in a new issue