*: 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>
33 lines
818 B
JavaScript
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();
|
|
},
|
|
});
|