mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-01-01 12:32:40 +08:00
Resolve #992
This commit is contained in:
parent
0144be49bf
commit
d8b05ee361
4 changed files with 15 additions and 5 deletions
|
@ -42,10 +42,11 @@ download = (link, name = "") => {
|
|||
}
|
||||
},
|
||||
|
||||
downloadZip = (hashes, onError, fTrigger, folder) => {
|
||||
downloadZip = (name, hashes, onError, fTrigger, folder) => {
|
||||
if (hashes.length) {
|
||||
let params = {
|
||||
target: 'zip',
|
||||
filename: name,
|
||||
hashes: hashes
|
||||
};
|
||||
if (!onError) {
|
||||
|
|
|
@ -363,13 +363,19 @@ export class MailMessageList extends AbstractViewRight {
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Download selected messages
|
||||
*/
|
||||
downloadZipCommand() {
|
||||
let hashes = []/*, uids = []*/;
|
||||
// MessagelistUserStore.forEach(message => message.checked() && uids.push(message.uid));
|
||||
MessagelistUserStore.forEach(message => message.checked() && hashes.push(message.requestHash));
|
||||
downloadZip(hashes, null, null, MessagelistUserStore().folder);
|
||||
downloadZip(null, hashes, null, null, MessagelistUserStore().folder);
|
||||
}
|
||||
|
||||
/**
|
||||
* Download attachments of selected messages
|
||||
*/
|
||||
downloadAttachCommand() {
|
||||
let hashes = [];
|
||||
MessagelistUserStore.forEach(message => {
|
||||
|
@ -381,7 +387,7 @@ export class MailMessageList extends AbstractViewRight {
|
|||
});
|
||||
}
|
||||
});
|
||||
downloadZip(hashes);
|
||||
downloadZip(null, hashes);
|
||||
}
|
||||
|
||||
deleteWithoutMoveCommand() {
|
||||
|
|
|
@ -469,7 +469,9 @@ export class MailMessageView extends AbstractViewRight {
|
|||
const hashes = (currentMessage()?.attachments || [])
|
||||
.map(item => item?.checked() /*&& !item?.isLinked()*/ ? item.download : '')
|
||||
.filter(v => v);
|
||||
downloadZip(hashes,
|
||||
downloadZip(
|
||||
currentMessage().subject(),
|
||||
hashes,
|
||||
() => this.downloadAsZipError(true),
|
||||
this.downloadAsZipLoading
|
||||
);
|
||||
|
|
|
@ -14,6 +14,7 @@ trait Attachments
|
|||
{
|
||||
$sAction = $this->GetActionParam('target', '');
|
||||
$sFolder = $this->GetActionParam('folder', '');
|
||||
$sFilename = \MailSo\Base\Utils::SecureFileName($this->GetActionParam('filename', ''));
|
||||
$aHashes = $this->GetActionParam('hashes', null);
|
||||
$oFilesProvider = $this->FilesProvider();
|
||||
if (empty($sAction) || !$this->GetCapa(Capa::ATTACHMENTS_ACTIONS) || !$oFilesProvider || !$oFilesProvider->IsActive()) {
|
||||
|
@ -108,7 +109,7 @@ trait Attachments
|
|||
if (!$bError) {
|
||||
$mResult = array(
|
||||
'fileHash' => $this->encodeRawKey($oAccount, array(
|
||||
'fileName' => ($sFolder ? 'messages' : 'attachments') . \date('-YmdHis') . '.zip',
|
||||
'fileName' => ($sFilename ?: ($sFolder ? 'messages' : 'attachments')) . \date('-YmdHis') . '.zip',
|
||||
'mimeType' => 'application/zip',
|
||||
'fileHash' => $sZipHash
|
||||
))
|
||||
|
|
Loading…
Reference in a new issue