[FIX] mail: avoid flicker when uploading multiple attachement

task-2282327

closes odoo/odoo#58358

X-original-commit: 413c6c406eac52048b9a0b80c7ee46efe5b061c4
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
Didier (did)
2020-09-23 14:27:20 +00:00
parent 2adf274798
commit 3c12f91fda
+11 -1
View File
@@ -883,7 +883,17 @@ function factory(dependencies) {
*/
_computeAllAttachments() {
const allAttachments = [...new Set(this.originThreadAttachments.concat(this.attachments))]
.sort((a1, a2) => a1.id < a2.id ? 1 : -1);
.sort((a1, a2) => {
// "uploading" before "uploaded" attachments.
if (!a1.isTemporary && a2.isTemporary) {
return 1;
}
if (a1.isTemporary && !a2.isTemporary) {
return -1;
}
// "most-recent" before "oldest" attachments.
return Math.abs(a2.id) - Math.abs(a1.id);
});
return [['replace', allAttachments]];
}