rating/static/tests/helpers/mock_server/models/mail_message.js

29 lines
945 B
JavaScript
Raw Normal View History

2024-05-03 15:15:12 +03:00
/** @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;
},
});