(web) Restore mail threads

Fixes #3478
Fixes #4616
Fixes #4735
This commit is contained in:
Francis Lachapelle
2019-06-27 17:43:11 -04:00
parent cc6fcc5fbd
commit b5949752b4
10 changed files with 142 additions and 20 deletions
@@ -26,6 +26,15 @@
this.init(futureMessageData);
}
this.uid = parseInt(futureMessageData.uid);
this.level = parseInt(futureMessageData.level);
this.first = parseInt(futureMessageData.first) === 1;
if (this.first) {
this.threadCount = parseInt(futureMessageData.count);
this.collapsed = (futureMessageData.collapsed === true);
}
else if (!isNaN(this.level) && this.level >= 0) {
this.threadMember = true;
}
}
else {
// The promise will be unwrapped first
@@ -539,7 +548,7 @@
};
/**
* @function $markAsFlaggedOrUnflagged
* @function toggleFlag
* @memberof Message.prototype
* @desc Add or remove a the \\Flagged flag on the current message.
* @returns a promise of the HTTP operation
@@ -558,6 +567,24 @@
});
};
/**
* @function toggleThread
* @memberof Message.prototype
* @desc Collapse or expand mail thread
* @returns a promise of the HTTP operation
*/
Message.prototype.toggleThread = function() {
var _this = this,
action = 'markMessageCollapse';
if (this.collapsed)
action = 'markMessageUncollapse';
this.collapsed = !this.collapsed;
return Message.$$resource.post(this.$absolutePath(), action);
};
/**
* @function $isLoading
* @memberof Message.prototype