djmaze 2020-09-23 12:18:36 +02:00
parent 1bb154d6f4
commit 39f39db447

View file

@ -1048,18 +1048,9 @@ class ComposePopupView extends AbstractViewNext {
const downloads = this.getAttachmentsDownloadsForUpload(); const downloads = this.getAttachmentsDownloadsForUpload();
if (Array.isNotEmpty(downloads)) { if (Array.isNotEmpty(downloads)) {
Remote.messageUploadAttachments(()=>this.onMessageUploadAttachments(), downloads); Remote.messageUploadAttachments((sResult, oData) => {
}
if (identity) {
this.currentIdentity(identity);
}
}
onMessageUploadAttachments(sResult, oData) {
if (StorageResultType.Success === sResult && oData && oData.Result) { if (StorageResultType.Success === sResult && oData && oData.Result) {
if (!this.viewModelVisibility()) { Object.entries(oData.Result).forEach(([tempName, id]) => {
oData.Result.forEach((id, tempName) => {
const attachment = this.getAttachmentById(id); const attachment = this.getAttachmentById(id);
if (attachment) { if (attachment) {
attachment.tempName(tempName); attachment.tempName(tempName);
@ -1069,9 +1060,22 @@ class ComposePopupView extends AbstractViewNext {
.complete(true); .complete(true);
} }
}); });
}
} else { } else {
this.setMessageAttachmentFailedDownloadText(); this.attachments().forEach(attachment => {
if (attachment && attachment.fromMessage) {
attachment
.waiting(false)
.uploading(false)
.complete(true)
.error(getUploadErrorDescByCode(UploadErrorCode.FileNoUploaded));
}
});
}
}, downloads);
}
if (identity) {
this.currentIdentity(identity);
} }
} }
@ -1404,18 +1408,6 @@ class ComposePopupView extends AbstractViewNext {
} }
} }
setMessageAttachmentFailedDownloadText() {
this.attachments().forEach(attachment => {
if (attachment && attachment.fromMessage) {
attachment
.waiting(false)
.uploading(false)
.complete(true)
.error(getUploadErrorDescByCode(UploadErrorCode.FileNoUploaded));
}
});
}
/** /**
* @param {boolean=} includeAttachmentInProgress = true * @param {boolean=} includeAttachmentInProgress = true
* @returns {boolean} * @returns {boolean}