mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-02-25 00:25:03 +08:00
Show the “Download All” button when an email has multiple images #583
This commit is contained in:
parent
8861fa50a8
commit
c509ac70bc
1 changed files with 17 additions and 25 deletions
|
@ -113,14 +113,6 @@ export default class MessageItem extends React.Component {
|
|||
Actions.toggleMessageIdExpanded(this.props.message.id);
|
||||
};
|
||||
|
||||
_isRealFile = file => {
|
||||
const hasCIDInBody =
|
||||
file.contentId !== undefined &&
|
||||
this.props.message.body &&
|
||||
this.props.message.body.indexOf(file.contentId) > 0;
|
||||
return !hasCIDInBody;
|
||||
};
|
||||
|
||||
_onDownloadStoreChange = () => {
|
||||
const fileIds = this.props.message.fileIds();
|
||||
this.setState({
|
||||
|
@ -146,27 +138,27 @@ export default class MessageItem extends React.Component {
|
|||
}
|
||||
|
||||
_renderAttachments() {
|
||||
const files = (this.props.message.files || []).filter(f => this._isRealFile(f));
|
||||
const messageId = this.props.message.id;
|
||||
const { files = [], body = '', id } = this.props.message;
|
||||
const { filePreviewPaths, downloads } = this.state;
|
||||
if (files.length === 0) {
|
||||
return <div />;
|
||||
}
|
||||
const attachedFiles = files.filter(f => !f.contentId || !body.includes(f.contentId));
|
||||
|
||||
return (
|
||||
<div>
|
||||
{files.length > 1 ? this._renderDownloadAllButton() : null}
|
||||
<div className="attachments-area">
|
||||
<InjectedComponent
|
||||
matching={{ role: 'MessageAttachments' }}
|
||||
exposedProps={{
|
||||
files,
|
||||
downloads,
|
||||
filePreviewPaths,
|
||||
messageId,
|
||||
canRemoveAttachments: false,
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
{attachedFiles.length > 0 && (
|
||||
<div className="attachments-area">
|
||||
<InjectedComponent
|
||||
matching={{ role: 'MessageAttachments' }}
|
||||
exposedProps={{
|
||||
files: attachedFiles,
|
||||
messageId: id,
|
||||
downloads,
|
||||
filePreviewPaths,
|
||||
canRemoveAttachments: false,
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue