Simplify message view attachment controls

This commit is contained in:
the-djmaze 2022-05-31 21:17:09 +02:00
parent baff1308e7
commit 5c99a14559
2 changed files with 6 additions and 11 deletions

View file

@ -123,9 +123,6 @@ export class MailMessageView extends AbstractViewRight {
this.fullScreenMode = isFullscreen;
this.toggleFullScreen = toggleFullscreen;
this.messageListOfThreadsLoading = ko.observable(false).extend({ rateLimit: 1 });
this.highlightUnselectedAttachments = ko.observable(false).extend({ falseTimeout: 2000 });
this.downloadAsZipError = ko.observable(false).extend({ falseTimeout: 7000 });
this.messageDomFocused = ko.observable(false).extend({ rateLimit: 0 });
@ -136,7 +133,10 @@ export class MailMessageView extends AbstractViewRight {
this.addComputables({
allowAttachmentControls: () => arrayLength(attachmentsActions) && SettingsCapa('AttachmentsActions'),
downloadAsZipAllowed: () => this.attachmentsActions.includes('zip') && this.allowAttachmentControls(),
downloadAsZipAllowed: () => this.attachmentsActions.includes('zip')
&& (currentMessage() ? currentMessage().attachments : [])
.filter(item => item && !item.isLinked() && item.checked() && item.download)
.length,
lastReplyAction: {
read: this.lastReplyAction_,
@ -538,8 +538,6 @@ export class MailMessageView extends AbstractViewRight {
}
})
.catch(() => this.downloadAsZipError(true));
} else {
this.highlightUnselectedAttachments(true);
}
}

View file

@ -213,8 +213,7 @@
data-icon="🖼" data-i18n="MESSAGE/BUTTON_SHOW_IMAGES"></div>
<div class="readReceipt" data-bind="visible: !isDraftOrSentFolder() && '' !== message().readReceipt() && !message().isReadReceipt(), click: readReceipt"
data-icon="✉" data-i18n="MESSAGE/BUTTON_NOTIFY_READ_RECEIPT"></div>
<div class="attachmentsPlace" data-bind="visible: message().hasAttachments(),
css: {'selection-mode' : showAttachmentControls, 'unselectedAttachmentsError': highlightUnselectedAttachments}">
<div class="attachmentsPlace" data-bind="visible: message().hasAttachments(), css: {'selection-mode' : showAttachmentControls}">
<ul class="attachmentList" data-bind="foreach: message() ? message().attachments() : []">
<li class="attachmentItem" draggable="true"
data-bind="visible: !isLinked(), event: { 'dragstart': eventDragStart }, attr: { 'title': fileName }, css: {'checked': checked}">
@ -241,7 +240,7 @@
click: function () { checked(!checked()); return false }"></div>
</li>
</ul>
<i class="fontastic controls-handle" data-bind="visible: allowAttachmentControls() && !showAttachmentControls(), click: toggleAttachmentControls"></i>
<i class="fontastic controls-handle" data-bind="visible: allowAttachmentControls(), click: toggleAttachmentControls"></i>
</div>
<div class="attachmentsControls"
@ -254,8 +253,6 @@
<span class="g-ui-link" data-bind="click: downloadAsZip"
data-i18n="MESSAGE/LINK_DOWNLOAD_AS_ZIP"></span>
</span>
<a href="#" class="close" style="margin-right: 5px;" data-bind="click: toggleAttachmentControls">×</a>
</div>
</div>