Files
odoo_source/addons/im_livechat/static/src/models/messaging.js
T
Alexandre Kühn d27546064a [IMP] im_livechat, *: Refactor JS Public Livechat (step 9)
*: website_livechat

This commit is a step towards refactoring the JS of public livechat,
so that it reuses the same architecture as the code of Discuss.
This implies code that uses JS models and OWL components.

Task-2928837

closes odoo/odoo#96690

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-07-28 02:40:06 +02:00

33 lines
818 B
JavaScript

/** @odoo-module **/
import { addFields, patchRecordMethods } from '@mail/model/model_core';
import { many, one } from '@mail/model/model_field';
import { clear } from '@mail/model/model_field_command';
// ensure that the model definition is loaded before the patch
import '@mail/models/messaging';
addFields('Messaging', {
/**
* All pinned livechats that are known.
*/
pinnedLivechats: many('Thread', {
inverse: 'messagingAsPinnedLivechat',
readonly: true,
}),
publicLivechatGlobal: one('PublicLivechatGlobal', {
isCausal: true,
}),
});
patchRecordMethods('Messaging', {
/**
* @override
*/
_computeNotificationHandler() {
if (this.publicLivechatGlobal) {
return clear();
}
return this._super();
},
});