Skip to content

Commit

Permalink
fix(mail(js)): show "Download all attachments" menu option
Browse files Browse the repository at this point in the history
  • Loading branch information
cgx committed Aug 19, 2021
1 parent 595b93e commit 86f08a2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
4 changes: 2 additions & 2 deletions UI/Templates/MailerUI/UIxMailViewTemplate.wox
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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"/>
Expand Down
16 changes: 16 additions & 0 deletions UI/WebServerResources/js/Mailer/Message.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 86f08a2

Please sign in to comment.