rating/static/tests/helpers/mock_server/models/mail_message.js
Данил Воробьев 36787116de initial commit
2024-05-03 12:15:12 +00:00

29 lines
945 B
JavaScript

/** @odoo-module **/
import '@mail/../tests/helpers/mock_server/models/mail_message'; // ensure mail overrides are applied first
import { patch } from "@web/core/utils/patch";
import { MockServer } from "@web/../tests/helpers/mock_server";
patch(MockServer.prototype, {
/**
* @override
*/
_mockMailMessageMessageFormat(ids) {
const formattedMessages = super._mockMailMessageMessageFormat(...arguments);
for (const formattedMessage of formattedMessages) {
const [rating] = this.getRecords('rating.rating', [
['message_id', '=', formattedMessage.id],
]);
if (rating) {
formattedMessage['rating'] = {
'id': rating.id,
'ratingImageUrl': rating.rating_image_url,
'ratingText': rating.rating_text,
};
}
}
return formattedMessages;
},
});