(js) Fix handling of attachments in mail editor

Fixes #4058, #4063
pull/234/head
Francis Lachapelle 2017-03-03 15:36:52 -05:00
parent 3c35c16bf3
commit 75aa6e90a2
3 changed files with 4 additions and 3 deletions

1
NEWS
View File

@ -19,6 +19,7 @@ Bug fixes
- [web] fixed CAS session timeout handling during XHR requests (#1456)
- [web] exposed default value of SOGoMailAutoSave (#4053)
- [web] fixed handling of contact organizations (#4028)
- [web] fixed handling of attachments in mail editor (#4058, #4063)
3.2.7 (2017-02-14)
------------------

View File

@ -157,7 +157,7 @@
*/
Mailbox.prototype.init = function(data) {
var _this = this;
if (data.headers) {
if (angular.isUndefined(this.uidsMap) || data.headers) {
this.$isLoading = true;
this.$messages = [];
this.uidsMap = {};

View File

@ -474,9 +474,9 @@
* @param {string} filename - the filename of the attachment to delete
*/
Message.prototype.$deleteAttachment = function(filename) {
var action = 'deleteAttachment?filename=' + filename;
var data = { 'filename': filename };
var _this = this;
Message.$$resource.post(this.$absolutePath({asDraft: true}), action).then(function(data) {
Message.$$resource.fetch(this.$absolutePath({asDraft: true}), 'deleteAttachment', data).then(function(data) {
Message.$timeout(function() {
_this.editable.attachmentAttrs = _.filter(_this.editable.attachmentAttrs, function(attachment) {
return attachment.filename != filename;