From ff44dbf31a3732a8ebced7ff907fff3b2440afc4 Mon Sep 17 00:00:00 2001 From: Ipsita Borisagar Date: Tue, 9 Feb 2021 04:48:29 +0000 Subject: [FIX] mail: prevent message separator for new conversations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before this commit: When a new conversation is initiated, the 'new messages' separator is displayed. This looks a bit weird as there is no history of conversation and thus no older messages from which new messages should be separated. After this commit: The 'new messages' separator will not be displayed in new conversations. LINKS PR https://github.com/odoo/odoo/pull/65952 Task-2453511 closes odoo/odoo#65952 Signed-off-by: Sébastien Theys (seb) --- addons/mail/static/src/models/thread/thread.js | 3 +++ 1 file changed, 3 insertions(+) (limited to 'addons/mail/static/src/models/thread/thread.js') diff --git a/addons/mail/static/src/models/thread/thread.js b/addons/mail/static/src/models/thread/thread.js index 31339e063f3..4739e59f91e 100644 --- a/addons/mail/static/src/models/thread/thread.js +++ b/addons/mail/static/src/models/thread/thread.js @@ -1344,6 +1344,9 @@ function factory(dependencies) { const index = this.orderedMessages.findIndex(message => message.id === this.lastSeenByCurrentPartnerMessageId ); + if (index === -1) { + return [['unlink']]; + } const message = this.orderedMessages[index + 1]; if (!message) { return [['unlink']]; -- cgit v1.2.3