[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
This commit is contained in:
Nicolas Martinelli
2015-12-03 15:31:18 +01:00
parent 02766b3fba
commit 0644cfc543
+2 -1
View File
@@ -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]);