fix(mail(js)): show "Download all attachments" menu option

This commit is contained in:
Francis Lachapelle
2021-08-19 17:15:12 -04:00
parent 595b93eafc
commit 86f08a2380
2 changed files with 18 additions and 2 deletions

View File

@@ -41,7 +41,7 @@
<md-icon>reply</md-icon>
</md-button>
<md-button class="sg-icon-button"
ng-show="viewer.message.allowReplyAll()"
ng-show="::viewer.message.allowReplyAll()"
ng-click="viewer.replyAll($event)"
label:aria-label="Reply All">
<md-tooltip md-direction="bottom"><var:string label:value="Reply to sender and all recipients"/></md-tooltip>
@@ -92,7 +92,7 @@
<var:string label:value="Download message (zip)"/>
</md-button>
</md-menu-item>
<md-menu-item ng-show="::viewer.message.attachmentAttrs.length">
<md-menu-item ng-show="::viewer.message.hasAttachments()">
<md-button label:aria-label="Download all attachments"
ng-click="viewer.message.downloadAttachmentsArchive()">
<var:string label:value="Download all attachments"/>

View File

@@ -556,6 +556,22 @@
return Message.$$resource.post(this.$absolutePath(), 'sendMDN');
};
/**
* @function hasAttachments
* @memberof Message.prototype
* @returns true if there's one ore more attached files
*/
Message.prototype.hasAttachments = function(content) {
var _this = this;
return !!_.find(content || this.parts.content, function(part) {
if (angular.isArray(part.content)) {
return _this.hasAttachments(part.content);
}
return part.type == 'UIxMailPartLinkViewer' || part.type == 'UIxMailPartImageViewer';
});
};
/**
* @function $deleteAttachment
* @memberof Message.prototype