Debian Codegraph @

addons/portal_rating/static/src/chatter/frontend/message_model_patch.js

raw
1 import { Message } from "@mail/core/common/message_model";
2 import { patch } from "@web/core/utils/patch";
3
4 /** @type {import("models").Message} */
5 const messagePatch = {
6 async remove({ removeFromThread = false } = {}) {
7 const data = await super.remove(...arguments);
8 if (this.thread && removeFromThread) {
9 this.thread.messages.forEach((message) => {
10 message.rating_stats = this.thread.rating_stats;
11 });
12 }
13 return data;
14 },
15 };
16 patch(Message.prototype, messagePatch);