From 3751379f1e9a4c215fb6eb898b4ccc67659b9ace Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Tue, 10 May 2022 21:51:50 +0700 Subject: initial commit 2 --- addons/im_livechat/static/src/bugfix/bugfix.js | 34 ++++++++++++++++++++++ addons/im_livechat/static/src/bugfix/bugfix.scss | 6 ++++ addons/im_livechat/static/src/bugfix/bugfix.xml | 11 +++++++ .../im_livechat/static/src/bugfix/bugfix_tests.js | 18 ++++++++++++ 4 files changed, 69 insertions(+) create mode 100644 addons/im_livechat/static/src/bugfix/bugfix.js create mode 100644 addons/im_livechat/static/src/bugfix/bugfix.scss create mode 100644 addons/im_livechat/static/src/bugfix/bugfix.xml create mode 100644 addons/im_livechat/static/src/bugfix/bugfix_tests.js (limited to 'addons/im_livechat/static/src/bugfix') diff --git a/addons/im_livechat/static/src/bugfix/bugfix.js b/addons/im_livechat/static/src/bugfix/bugfix.js new file mode 100644 index 00000000..2a81f5e2 --- /dev/null +++ b/addons/im_livechat/static/src/bugfix/bugfix.js @@ -0,0 +1,34 @@ +/** + * This file allows introducing new JS modules without contaminating other files. + * This is useful when bug fixing requires adding such JS modules in stable + * versions of Odoo. Any module that is defined in this file should be isolated + * in its own file in master. + */ +odoo.define('im_livechat/static/src/bugfix/bugfix.js', function (require) { +'use strict'; + +const { + registerInstancePatchModel, +} = require('mail/static/src/model/model_core.js'); + +registerInstancePatchModel('mail.chat_window', 'im_livechat/static/src/models/chat_window/chat_window.js', { + + /** + * @override + */ + close({ notifyServer } = {}) { + if ( + this.thread && + this.thread.model === 'mail.channel' && + this.thread.channel_type === 'livechat' && + this.thread.mainCache.isLoaded && + this.thread.messages.length === 0 + ) { + notifyServer = true; + this.thread.unpin(); + } + this._super({ notifyServer }); + } +}); + +}); diff --git a/addons/im_livechat/static/src/bugfix/bugfix.scss b/addons/im_livechat/static/src/bugfix/bugfix.scss new file mode 100644 index 00000000..c4272e52 --- /dev/null +++ b/addons/im_livechat/static/src/bugfix/bugfix.scss @@ -0,0 +1,6 @@ +/** +* This file allows introducing new styles without contaminating other files. +* This is useful when bug fixing requires adding new components for instance in +* stable versions of Odoo. Any style that is defined in this file should be isolated +* in its own file in master. +*/ diff --git a/addons/im_livechat/static/src/bugfix/bugfix.xml b/addons/im_livechat/static/src/bugfix/bugfix.xml new file mode 100644 index 00000000..c17906f7 --- /dev/null +++ b/addons/im_livechat/static/src/bugfix/bugfix.xml @@ -0,0 +1,11 @@ + + + + + + diff --git a/addons/im_livechat/static/src/bugfix/bugfix_tests.js b/addons/im_livechat/static/src/bugfix/bugfix_tests.js new file mode 100644 index 00000000..33cfeacf --- /dev/null +++ b/addons/im_livechat/static/src/bugfix/bugfix_tests.js @@ -0,0 +1,18 @@ +odoo.define('im_livechat/static/src/bugfix/bugfix_tests.js', function (require) { +'use strict'; + +/** + * This file allows introducing new QUnit test modules without contaminating + * other test files. This is useful when bug fixing requires adding new + * components for instance in stable versions of Odoo. Any test that is defined + * in this file should be isolated in its own file in master. + */ +QUnit.module('im_livechat', {}, function () { +QUnit.module('bugfix', {}, function () { +QUnit.module('bugfix_tests.js', { + +}); +}); +}); + +}); -- cgit v1.2.3