diff options
| author | Aaron Bohy <aab@odoo.com> | 2015-11-10 11:46:40 +0100 |
|---|---|---|
| committer | Géry Debongnie <ged@odoo.com> | 2015-11-12 08:51:56 +0100 |
| commit | dbc1061854c42578905f2aa6ecd0e77e3732c01a (patch) | |
| tree | 7310520fc1d50c5cb4d1e8d39e675123e61a6b36 /addons/mail/static/src/js | |
| parent | a0b88297987680d4868863c4c78e0c1c17b2b955 (diff) | |
[FIX] mail: load more messages: correct search domain
The problem was that the load more feature didn't return directly preceeding
messages in the thread but rather older messages.
Diffstat (limited to 'addons/mail/static/src/js')
| -rw-r--r-- | addons/mail/static/src/js/chat_manager.js | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/addons/mail/static/src/js/chat_manager.js b/addons/mail/static/src/js/chat_manager.js index 8225459e9b3..6bd96fdc32d 100644 --- a/addons/mail/static/src/js/chat_manager.js +++ b/addons/mail/static/src/js/chat_manager.js @@ -238,18 +238,19 @@ function remove_message_from_channel (channel_id, message) { // options: domain, load_more function fetch_from_channel (channel, options) { + options = options || {}; var domain = (channel.id === "channel_inbox") ? [['needaction', '=', true]] : (channel.id === "channel_starred") ? [['starred', '=', true]] : [['channel_ids', 'in', channel.id]]; + var cache = get_channel_cache(channel, options.domain); - options = options || {}; if (options.domain) { domain = new data.CompoundDomain(domain, options.domain || []); } if (options.load_more) { var min_message_id = _.chain(messages) - .filter(function (msg) { return _.contains(msg.channel_ids, channel.id); }) + .filter(function (msg) { return _.contains(cache.message_ids, msg.id); }) .pluck("id") .min() .value(); @@ -258,8 +259,6 @@ function fetch_from_channel (channel, options) { } return MessageModel.call('message_fetch', [domain], {limit: LIMIT}).then(function (msgs) { - var cache = get_channel_cache(channel, options.domain); - cache.message_ids = _.uniq(cache.message_ids.concat(_.pluck(msgs, 'id'))); if (!cache.all_history_loaded) { cache.all_history_loaded = msgs.length < LIMIT; |
