diff options
| author | Didier (did) <did@odoo.com> | 2020-09-17 13:11:36 +0000 |
|---|---|---|
| committer | Didier (did) <did@odoo.com> | 2020-09-23 14:02:33 +0000 |
| commit | 32f8e15466e3911ae9083d0c9c07a42283a12d13 (patch) | |
| tree | 0119949d34821b3e1ccf08866873820022daf837 /addons/mail/static/src/models/thread/thread.js | |
| parent | 363139d942395b00b043f78a3c3c09c70a279cf8 (diff) | |
[FIX] mail: avoid flicker when uploading multiple attachement
task-2282327
closes odoo/odoo#58354
X-original-commit: 413c6c406eac52048b9a0b80c7ee46efe5b061c4
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Diffstat (limited to 'addons/mail/static/src/models/thread/thread.js')
| -rw-r--r-- | addons/mail/static/src/models/thread/thread.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/addons/mail/static/src/models/thread/thread.js b/addons/mail/static/src/models/thread/thread.js index bed46a7f41b..01737253e6c 100644 --- a/addons/mail/static/src/models/thread/thread.js +++ b/addons/mail/static/src/models/thread/thread.js @@ -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]]; } |
