mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-28 19:49:20 +03:00
Resolve #361
This commit is contained in:
parent
7e1b85d023
commit
ecf53b1285
40 changed files with 161 additions and 111 deletions
|
|
@ -11,11 +11,11 @@ import { leftPanelDisabled, moveAction,
|
|||
addShortcut, registerShortcut, formFieldFocused
|
||||
} from 'Common/Globals';
|
||||
|
||||
import { computedPaginatorHelper, showMessageComposer, populateMessageBody } from 'Common/UtilsUser';
|
||||
import { computedPaginatorHelper, showMessageComposer, populateMessageBody, download } from 'Common/UtilsUser';
|
||||
import { FileInfo } from 'Common/File';
|
||||
import { isFullscreen, toggleFullscreen } from 'Common/Fullscreen';
|
||||
|
||||
import { mailBox } from 'Common/Links';
|
||||
import { mailBox, attachmentDownload } from 'Common/Links';
|
||||
import { Selector } from 'Common/Selector';
|
||||
|
||||
import { i18n } from 'Common/Translator';
|
||||
|
|
@ -258,6 +258,7 @@ export class MailMessageList extends AbstractViewRight {
|
|||
).throttle(50));
|
||||
|
||||
decorateKoCommands(this, {
|
||||
downloadCommand: canBeMovedHelper,
|
||||
forwardCommand: canBeMovedHelper,
|
||||
deleteWithoutMoveCommand: canBeMovedHelper,
|
||||
deleteCommand: canBeMovedHelper,
|
||||
|
|
@ -290,6 +291,34 @@ export class MailMessageList extends AbstractViewRight {
|
|||
]);
|
||||
}
|
||||
|
||||
downloadCommand() {
|
||||
let hashes = [];
|
||||
MessagelistUserStore.forEach(message => {
|
||||
if (message.checked()) {
|
||||
message.attachments.forEach(attachment => {
|
||||
if (!attachment.isLinked() && attachment.download) {
|
||||
hashes.push(attachment.download);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
if (hashes.length) {
|
||||
Remote.post('AttachmentsActions', null, {
|
||||
Do: 'Zip',
|
||||
Hashes: hashes
|
||||
})
|
||||
.then(result => {
|
||||
let hash = result?.Result?.FileHash;
|
||||
if (hash) {
|
||||
download(attachmentDownload(hash), hash+'.zip');
|
||||
} else {
|
||||
alert('Download failed');
|
||||
}
|
||||
})
|
||||
.catch(() => alert('Download failed'));
|
||||
}
|
||||
}
|
||||
|
||||
deleteWithoutMoveCommand() {
|
||||
SettingsCapa('DangerousActions')
|
||||
&& moveMessagesToFolderType(FolderType.Trash, true);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue