diff options
| author | Xavier Dubuc <xdu@odoo.com> | 2020-07-14 12:36:27 +0000 |
|---|---|---|
| committer | Xavier Dubuc <xdu@odoo.com> | 2020-07-17 14:49:32 +0000 |
| commit | eb99a019ed6eb689cd06cf595c06e8ffe4e120b1 (patch) | |
| tree | 9b6833d4848df696220c133c4b9a14b3fe84a6b7 /addons/mail/static/src/models | |
| parent | 2e17c0458c63661672b25b1a2fe7b46226d09381 (diff) | |
[FIX] mail: fix inbox mark as read on single message
Clicking on mark as read on a given message would move all messages in
inbox to history instead of only selected message(s). This commit fix
that behaviour so that only the selected message(s) move(s) to history.
task-2284543
closes odoo/odoo#54688
X-original-commit: 3304b89fc799b979b028aa4c7efe902b2f5276c1
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Diffstat (limited to 'addons/mail/static/src/models')
| -rw-r--r-- | addons/mail/static/src/models/messaging_notification_handler/messaging_notification_handler.js | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/addons/mail/static/src/models/messaging_notification_handler/messaging_notification_handler.js b/addons/mail/static/src/models/messaging_notification_handler/messaging_notification_handler.js index f92521f248e..86cd5919b53 100644 --- a/addons/mail/static/src/models/messaging_notification_handler/messaging_notification_handler.js +++ b/addons/mail/static/src/models/messaging_notification_handler/messaging_notification_handler.js @@ -530,12 +530,20 @@ function factory(dependencies) { // 1. move messages from inbox to history // AKU TODO: flag other caches to invalidate // task-2171873 - inboxMailbox.messages.map(message => { - message.update({ - isNeedaction: false, - isHistory: true, - }); - }); + for (const message_id of message_ids) { + // We need to ignore all not yet known messages because we don't want them + // to be shown partially as they would be linked directly to mainCache + // Furthermore, server should not send back all message_ids marked as read + // but something like last read message_id or something like that. + // (just imagine you mark 1000 messages as read ... ) + const message = this.env.models['mail.message'].find(m => m.id === message_id); + if (message) { + message.update({ + isNeedaction: false, + isHistory: true, + }); + } + } // 2. remove "needaction" from channels let channels; |
