(feat) improved the attachments handling code for the message editor

This commit is contained in:
Ludovic Marcotte authored and Francis Lachapelle committed 2015-06-12 12:06:00 -04:00
1 parent 290264262c
commit 23d7c06829
5 files changed
+70 -28

No files matched your search

@@ -310,6 +310,25 @@
});
};
/**
* @function $deleteAttachment
* @memberof Message.prototype
* @desc Delete an attachment from a message being composed
* @param {string} filename - the filename of the attachment to delete
*/
Message.prototype.$deleteAttachment = function(filename) {
var action = 'deleteAttachment?filename=' + filename;
var _this = this;
Message.$$resource.post(this.$absolutePath({asDraft: true}), action).then(function(data) {
Message.$timeout(function() {
_this.editable.attachmentAttrs = _.filter(_this.editable.attachmentAttrs, function(attachment) {
return attachment.filename != filename});
}, function() {
// TODO: show toast
});
});
}
/**
* @function $markAsFlaggedOrUnflagged
* @memberof Message.prototype