From 10cf85e4c5db18be1dd2a48cddc336356f12d33d Mon Sep 17 00:00:00 2001 From: Mohammed Shekha Date: Thu, 11 Oct 2018 13:34:12 +0000 Subject: [PATCH] [FIX] mail: ignore popover if bootstrap not available Before this commit, there may be a silent crash when accessing the livechat from the customer URL, e.g. `http://mycompany.odoo.com/im_livechat/support/1`. This issue occurs when bootstrap popover lib is not available. This does not occur if one tab of the current browser has this lib loaded. To reproduce this issue, open the customer URL from another browser: 1. Access to `/web` from any browser (e.g. Chrome) 2. Go to Live Chat app 3. Select a livechat channel 4. Go to sheet page "Widget" 5. Copy text of the customer URL (2nd "Copy Text") 6. Paste the URL in a different browser (e.g. Firefox) 7. Open the livechat menu 8. Inspect dev tools => It will complain that `popover` is not a function. We would like to keep the livechat lib as small as possible, so instead of importing the boostrap lib, we simply prevent the logic that generates the issue. Task-ID 1885445 --- addons/mail/static/src/js/thread_widget.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/mail/static/src/js/thread_widget.js b/addons/mail/static/src/js/thread_widget.js index 10ecb5d2824..aff6b27bfdd 100644 --- a/addons/mail/static/src/js/thread_widget.js +++ b/addons/mail/static/src/js/thread_widget.js @@ -446,6 +446,9 @@ var ThreadWidget = Widget.extend({ if (this._messageMailPopover) { this._messageMailPopover.popover('hide'); } + if (!this.$('.o_thread_tooltip').length) { + return; + } this._messageMailPopover = this.$('.o_thread_tooltip').popover({ html: true, boundary: 'viewport',