Bugfix: message threaded mode was broken (knockout computable requires call to observable)

This commit is contained in:
djmaze 2021-03-08 15:21:54 +01:00
parent dade7756f8
commit e2d6528bf5
2 changed files with 4 additions and 5 deletions

View file

@ -86,7 +86,7 @@ export class MessageModel extends AbstractModel {
this.addComputables({ this.addComputables({
attachmentIconClass: () => FileInfo.getCombinedIconClass(this.hasAttachments() ? this.attachmentsSpecData() : []), attachmentIconClass: () => FileInfo.getCombinedIconClass(this.hasAttachments() ? this.attachmentsSpecData() : []),
threadsLen: () => this.threads.length, threadsLen: () => this.threads().length,
isImportant: () => MessagePriority.High === this.priority(), isImportant: () => MessagePriority.High === this.priority(),
}); });
} }

View file

@ -247,7 +247,6 @@ class ComposePopupView extends AbstractViewPopup {
}, },
attachmentsInProcess: () => this.attachments.filter(item => item && !item.complete()), attachmentsInProcess: () => this.attachments.filter(item => item && !item.complete()),
attachmentsInReady: () => this.attachments.filter(item => item && item.complete()),
attachmentsInError: () => this.attachments.filter(item => item && item.error()), attachmentsInError: () => this.attachments.filter(item => item && item.error()),
attachmentsCount: () => this.attachments.length, attachmentsCount: () => this.attachments.length,
@ -1318,8 +1317,8 @@ class ComposePopupView extends AbstractViewPopup {
*/ */
prepearAttachmentsForSendOrSave() { prepearAttachmentsForSendOrSave() {
const result = {}; const result = {};
this.attachmentsInReady().forEach(item => { this.attachments.forEach(item => {
if (item && item.tempName() && item.enabled()) { if (item && item.complete() && item.tempName() && item.enabled()) {
result[item.tempName()] = [item.fileName(), item.isInline ? '1' : '0', item.CID, item.contentLocation]; result[item.tempName()] = [item.fileName(), item.isInline ? '1' : '0', item.CID, item.contentLocation];
} }
}); });
@ -1417,7 +1416,7 @@ class ComposePopupView extends AbstractViewPopup {
isEmptyForm(includeAttachmentInProgress = true) { isEmptyForm(includeAttachmentInProgress = true) {
const withoutAttachment = includeAttachmentInProgress const withoutAttachment = includeAttachmentInProgress
? !this.attachments.length ? !this.attachments.length
: !this.attachmentsInReady().length; : !this.attachments.some(item => item && item.complete());
return ( return (
!this.to.length && !this.to.length &&