[FIX] mail, im_livechat: consider all init channels as pinned
task-2347732 closes odoo/odoo#59028 X-original-commit: f1ac4bb61d1bc02c4b69dc31a2869fbd15852514 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:
@@ -20,9 +20,14 @@ registerInstancePatchModel('mail.messaging_initializer', 'im_livechat/static/src
|
||||
// there might be a lot of channels, insert each of them one by
|
||||
// one asynchronously to avoid blocking the UI
|
||||
await this.async(() => new Promise(resolve => setTimeout(resolve)));
|
||||
this.env.models['mail.thread'].insert(
|
||||
const channel = this.env.models['mail.thread'].insert(
|
||||
this.env.models['mail.thread'].convertData(data),
|
||||
);
|
||||
// flux specific: channels received at init have to be
|
||||
// considered pinned. task-2284357
|
||||
if (!channel.isPinned) {
|
||||
channel.update({ isPendingPinned: true });
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
@@ -153,9 +153,14 @@ function factory(dependencies) {
|
||||
// there might be a lot of channels, insert each of them one by
|
||||
// one asynchronously to avoid blocking the UI
|
||||
await this.async(() => new Promise(resolve => setTimeout(resolve)));
|
||||
this.env.models['mail.thread'].insert(
|
||||
const channel = this.env.models['mail.thread'].insert(
|
||||
this.env.models['mail.thread'].convertData(channelData)
|
||||
);
|
||||
// flux specific: channels received at init have to be
|
||||
// considered pinned. task-2284357
|
||||
if (!channel.isPinned) {
|
||||
channel.update({ isPendingPinned: true });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -164,13 +164,6 @@ function factory(dependencies) {
|
||||
}
|
||||
if ('is_pinned' in data) {
|
||||
data2.isServerPinned = data.is_pinned;
|
||||
// FIXME: The following is admittedly odd.
|
||||
// Fixing it should entail a deeper reflexion on the group_based_subscription
|
||||
// and is_pinned functionalities, especially in python.
|
||||
// task-2284357
|
||||
if ('group_based_subscription' in data && data.group_based_subscription) {
|
||||
data2.isServerPinned = true;
|
||||
}
|
||||
}
|
||||
if ('last_message' in data && data.last_message) {
|
||||
data2.messagesAsServerChannel.push(['insert', { id: data.last_message.id }]);
|
||||
|
||||
Reference in New Issue
Block a user