[FIX] mail: reintroduce scroll to top on posting message in chatter
The feature was broken in https://github.com/odoo/odoo/commit/80d74e7ee0eab83dc5100e0776df09d04b882fec#diff-14904a101d1c0589d79515df7065aeeaaf0d4cdeaff9a4748ff0331c481efe8eL275 where `loadNewMessages` was mistakenly removed. But this call is useful to make sure newly posted messages (from other users) are fetched, as well as having the side-effect to scroll to the newly posted message of the current user in particular. closes odoo/odoo#87114 X-original-commit: 1550e08945597f3a49a7c8adec3cc0c2d9afdf82 Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com> Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
This commit is contained in:
@@ -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':
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user