mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-28 19:49:20 +03:00
Improved Jua uploader
This commit is contained in:
parent
2cb73643ca
commit
9e28eb5fc7
5 changed files with 45 additions and 66 deletions
|
|
@ -1096,9 +1096,6 @@ class ComposePopupView extends AbstractViewPopup {
|
|||
attachmentSizeLimit = pInt(SettingsGet('AttachmentLimit')),
|
||||
oJua = new Jua({
|
||||
action: serverRequest('Upload'),
|
||||
name: 'uploader',
|
||||
queueSize: 2,
|
||||
multipleSizeLimit: 50,
|
||||
clickElement: this.composeUploaderButton(),
|
||||
dragAndDropElement: this.composeUploaderDropPlace()
|
||||
});
|
||||
|
|
@ -1176,23 +1173,24 @@ class ComposePopupView extends AbstractViewPopup {
|
|||
})
|
||||
.on('onComplete', (id, result, data) => {
|
||||
const attachment = this.getAttachmentById(id),
|
||||
errorCode = data && data.Result && data.Result.ErrorCode ? data.Result.ErrorCode : null,
|
||||
attachmentJson = result && data && data.Result && data.Result.Attachment ? data.Result.Attachment : null;
|
||||
response = (data && data.Result) || {},
|
||||
errorCode = response.ErrorCode,
|
||||
attachmentJson = result && response.Attachment;
|
||||
|
||||
let error = '';
|
||||
if (null !== errorCode) {
|
||||
if (null != errorCode) {
|
||||
error = getUploadErrorDescByCode(errorCode);
|
||||
} else if (!attachmentJson) {
|
||||
error = i18n('UPLOAD/ERROR_UNKNOWN');
|
||||
}
|
||||
|
||||
if (attachment) {
|
||||
if (error && error.length) {
|
||||
if (error) {
|
||||
attachment
|
||||
.waiting(false)
|
||||
.uploading(false)
|
||||
.complete(true)
|
||||
.error(error);
|
||||
.error(error + '\n' + response.ErrorMessage);
|
||||
} else if (attachmentJson) {
|
||||
attachment
|
||||
.waiting(false)
|
||||
|
|
|
|||
|
|
@ -472,10 +472,7 @@ class ContactsPopupView extends AbstractViewPopup {
|
|||
if (this.importUploaderButton()) {
|
||||
const j = new Jua({
|
||||
action: serverRequest('UploadContacts'),
|
||||
name: 'uploader',
|
||||
queueSize: 1,
|
||||
multipleSizeLimit: 1,
|
||||
disableMultiple: true,
|
||||
limit: 1,
|
||||
disableDocumentDropPrevent: true,
|
||||
clickElement: this.importUploaderButton()
|
||||
});
|
||||
|
|
|
|||
|
|
@ -720,8 +720,7 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
|
|||
const oJua = new Jua({
|
||||
action: serverRequest('Append'),
|
||||
name: 'AppendFile',
|
||||
queueSize: 1,
|
||||
multipleSizeLimit: 1,
|
||||
limit: 1,
|
||||
hidden: {
|
||||
Folder: () => FolderUserStore.currentFolderFullNameRaw()
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue