diff --git a/addons/mail/static/src/components/message_list/message_list.js b/addons/mail/static/src/components/message_list/message_list.js index 224d3a65c3a..650b2e2e1a3 100644 --- a/addons/mail/static/src/components/message_list/message_list.js +++ b/addons/mail/static/src/components/message_list/message_list.js @@ -106,6 +106,7 @@ export class MessageList extends Component { // saved position if it exists or scroll to the end this._adjustScrollFromModel(); break; + case 'message-posted': case 'message-received': case 'messages-loaded': case 'new-messages-loaded': diff --git a/addons/mail/static/src/models/composer_view.js b/addons/mail/static/src/models/composer_view.js index 35a24c018df..76473c095b4 100644 --- a/addons/mail/static/src/models/composer_view.js +++ b/addons/mail/static/src/models/composer_view.js @@ -369,13 +369,15 @@ registerModel({ for (const threadView of message.originThread.threadViews) { // Reset auto scroll to be able to see the newly posted message. threadView.update({ hasAutoScrollOnMessageReceived: true }); + threadView.addComponentHint('message-posted', { message }); } if (chatterThread) { if (this.exists()) { this.delete(); } if (chatterThread.exists()) { - chatterThread.fetchData(['followers', 'suggestedRecipients']); + // Load new messages to fetch potential new messages from other users (useful due to lack of auto-sync in chatter). + chatterThread.fetchData(['followers', 'messages', 'suggestedRecipients']); } } if (threadViewThread) { diff --git a/addons/mail/static/src/models/thread_cache.js b/addons/mail/static/src/models/thread_cache.js index 1b480e49ae8..8ad1553c8c3 100644 --- a/addons/mail/static/src/models/thread_cache.js +++ b/addons/mail/static/src/models/thread_cache.js @@ -54,7 +54,7 @@ registerModel({ } const messageIds = this.fetchedMessages.map(message => message.id); const fetchedMessages = this._loadMessages({ minId: Math.max(...messageIds) }); - if (!fetchedMessages) { + if (!fetchedMessages || fetchedMessages.length === 0) { return; } for (const threadView of this.threadViews) {