mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-09-10 06:34:40 +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: =>
|
_renderCollapsed: =>
|
||||||
attachmentIcon = []
|
attachmentIcon = []
|
||||||
if @props.message.files.length > 0
|
if Utils.showIconForAttachments(@props.message.files)
|
||||||
attachmentIcon = <div className="collapsed-attachment"></div>
|
attachmentIcon = <div className="collapsed-attachment"></div>
|
||||||
|
|
||||||
<div className={@props.className} onClick={@_toggleCollapsed}>
|
<div className={@props.className} onClick={@_toggleCollapsed}>
|
||||||
|
|
|
@ -76,8 +76,11 @@ c3 = new ListTabular.Column
|
||||||
name: "Message"
|
name: "Message"
|
||||||
flex: 4
|
flex: 4
|
||||||
resolver: (thread) =>
|
resolver: (thread) =>
|
||||||
attachment = []
|
attachment = false
|
||||||
if thread.hasAttachments
|
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>
|
attachment = <div className="thread-icon thread-icon-attachment"></div>
|
||||||
|
|
||||||
<span className="details">
|
<span className="details">
|
||||||
|
@ -114,11 +117,15 @@ cNarrow = new ListTabular.Column
|
||||||
name: "Item"
|
name: "Item"
|
||||||
flex: 1
|
flex: 1
|
||||||
resolver: (thread) =>
|
resolver: (thread) =>
|
||||||
pencil = []
|
pencil = false
|
||||||
attachment = []
|
attachment = false
|
||||||
hasDraft = _.find (thread.metadata ? []), (m) -> m.draft
|
metadata = (thread.metadata ? [])
|
||||||
if thread.hasAttachments
|
|
||||||
|
hasAttachments = thread.hasAttachments and metadata.find (m) -> Utils.showIconForAttachments(m.files)
|
||||||
|
if hasAttachments
|
||||||
attachment = <div className="thread-icon thread-icon-attachment"></div>
|
attachment = <div className="thread-icon thread-icon-attachment"></div>
|
||||||
|
|
||||||
|
hasDraft = _.find metadata, (m) -> m.draft
|
||||||
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} />
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,10 @@ Utils =
|
||||||
window.requestAnimationFrame(attempt)
|
window.requestAnimationFrame(attempt)
|
||||||
attempt()
|
attempt()
|
||||||
|
|
||||||
|
showIconForAttachments: (files) ->
|
||||||
|
return false unless files instanceof Array
|
||||||
|
return files.find (f) -> !f.contentId or f.size > 3 * 1024
|
||||||
|
|
||||||
extractTextFromHtml: (html, {maxLength} = {}) ->
|
extractTextFromHtml: (html, {maxLength} = {}) ->
|
||||||
if (html ? "").trim().length is 0 then return ""
|
if (html ? "").trim().length is 0 then return ""
|
||||||
if maxLength and html.length > maxLength
|
if maxLength and html.length > maxLength
|
||||||
|
|
Loading…
Add table
Reference in a new issue