[FIX] mail: fix missing identifying field in record insert
When a message is posted, the server sends a `mail.record/insert` notification to update the related channel pin state. In order to recognize the thread, the client needs its id and its model. Currently, only the id is passed so the thread pin state is not updated. This PR adds the model to the notification. closes odoo/odoo#155150 Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
This commit is contained in:
@@ -118,15 +118,13 @@ patch(MockServer.prototype, {
|
||||
if (typeof target === "string") {
|
||||
return channel === target;
|
||||
}
|
||||
if (Array.isArray(channel) !== Array.isArray(target)) {
|
||||
return false;
|
||||
}
|
||||
if (Array.isArray(channel)) {
|
||||
const { __model: cModel, id: cId } = channel;
|
||||
const { __model: tModel, id: tId } = target;
|
||||
return (
|
||||
Array.isArray(target) &&
|
||||
cModel === tModel &&
|
||||
cId === tId &&
|
||||
channel[1] === target[1]
|
||||
);
|
||||
const { __model: cModel, id: cId } = channel[0];
|
||||
const { __model: tModel, id: tId } = target[0];
|
||||
return cModel === tModel && cId === tId && channel[1] === target[1];
|
||||
}
|
||||
return channel?.__model === target.__model && channel?.id === target?.id;
|
||||
})
|
||||
|
||||
@@ -583,7 +583,9 @@ class Channel(models.Model):
|
||||
# notification of the message itself to ensure the channel automatically opens.
|
||||
payload = {"id": self.id, "last_interest_dt": fields.Datetime.now()}
|
||||
bus_notifications = [
|
||||
((self, "members"), "mail.record/insert", {"Thread": {"id": self.id, "is_pinned": True}}),
|
||||
((self, "members"), "mail.record/insert", {
|
||||
"Thread": {"id": self.id, "is_pinned": True, "model": "discuss.channel"}
|
||||
}),
|
||||
(self, "discuss.channel/last_interest_dt_changed", payload),
|
||||
(self, "discuss.channel/new_message", {"id": self.id, "message": message_format}),
|
||||
]
|
||||
|
||||
@@ -341,6 +341,7 @@ patch(MockServer.prototype, {
|
||||
Thread: {
|
||||
id: channel.id,
|
||||
is_pinned: true,
|
||||
model: "discuss.channel",
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user