From 0644cfc543a58f9d11d5aca112cda0f131cb831e Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Thu, 3 Dec 2015 13:38:26 +0100 Subject: [PATCH] [FIX] mail: message not found message_ids contains the ids of all the messages. However, a maximum of 100 messages are fetched when a page is open, and therefore some messages might not be found in the JS cache. This leads to message.is_needaction throwing an exception. This fix returns True if the message is not found. It means that the message will be set as 'read' even if it is not displayed. opw-657896 --- addons/mail/static/src/js/chat_manager.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/mail/static/src/js/chat_manager.js b/addons/mail/static/src/js/chat_manager.js index c9cf65ac883..a75ce7742e0 100644 --- a/addons/mail/static/src/js/chat_manager.js +++ b/addons/mail/static/src/js/chat_manager.js @@ -557,7 +557,8 @@ var chat_manager = { mark_as_read: function (message_ids) { var ids = _.filter(message_ids, function (id) { var message = _.findWhere(messages, {id: id}); - return message.is_needaction; + // If too many messages, not all are fetched, and some might not be found + return !message || message.is_needaction; }); if (ids.length) { return MessageModel.call('set_message_done', [ids]);