[IMP] website: enable livechat button in website preview
The livechat button was disabled in website preview because its implementation could not properly handle being in an iframe inside the backend [1]. With the public livechat code being refactored to use discuss code, this is no longer a problem, so the livechat button can be present again. This also makes previewing the website more correct: the livechat button is actual present on the website, so hiding it was a lie. By re-enabling the livechat button, this also allow to remove the test coverage by a tour, which was sometimes failing on runbot due to tour being small and doing `im_livechat/init` rpc after the end of the tour. [1]: https://github.com/odoo/odoo/commit/e86c1ce94a148745d58ac38e408e1bc947978670 runbot-24631 closes odoo/odoo#135913 Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
@@ -180,7 +180,6 @@
|
||||
'website/static/src/components/website_loader/website_loader.js',
|
||||
'website/static/src/components/website_loader/website_loader.scss',
|
||||
'website/static/src/components/views/*',
|
||||
'website/static/src/services/chat_window_service_patch.js',
|
||||
'website/static/src/services/website_service.js',
|
||||
'website/static/src/js/utils.js',
|
||||
'website/static/src/xml/website.xml',
|
||||
|
||||
@@ -125,7 +125,6 @@ export class WebsitePreview extends Component {
|
||||
// OdooFrameContentLoaded event to unblock the iframe, as it is
|
||||
// triggered faster than the load event.
|
||||
this.iframe.el.addEventListener('OdooFrameContentLoaded', () => this.websiteService.unblockPreview('load-iframe'), { once: true });
|
||||
this.websiteService.context.isPreviewOpen = true;
|
||||
});
|
||||
|
||||
onWillUnmount(() => {
|
||||
@@ -135,7 +134,6 @@ export class WebsitePreview extends Component {
|
||||
this.websiteService.currentWebsiteId = null;
|
||||
this.websiteService.websiteRootInstance = undefined;
|
||||
this.websiteService.pageDocument = null;
|
||||
this.websiteService.context.isPreviewOpen = false;
|
||||
});
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
/* @odoo-module */
|
||||
|
||||
import { ChatWindowService } from "@mail/core/common/chat_window_service";
|
||||
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
|
||||
patch(ChatWindowService.prototype, {
|
||||
get visible() {
|
||||
return this.env.services.website?.context.isPreviewOpen ? [] : super.visible;
|
||||
},
|
||||
});
|
||||
@@ -50,7 +50,6 @@ export const websiteService = {
|
||||
showAceEditor: false,
|
||||
edition: false,
|
||||
isPublicRootReady: false,
|
||||
isPreviewOpen: false,
|
||||
snippetsLoaded: false,
|
||||
isMobile: false,
|
||||
});
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
/* @odoo-module */
|
||||
|
||||
import { registry } from "@web/core/registry";
|
||||
|
||||
import wTourUtils from "@website/js/tours/tour_utils";
|
||||
|
||||
registry.category("web_tour.tours").add("test_hide_chat_window_on_preview", {
|
||||
test: true,
|
||||
steps: () => [
|
||||
{
|
||||
trigger: ".o-mail-ChatWindow",
|
||||
run() {
|
||||
window.location.href = wTourUtils.getClientActionUrl("/");
|
||||
},
|
||||
},
|
||||
{
|
||||
trigger: ".o_website_preview",
|
||||
run() {
|
||||
if (document.querySelector(".o-mail-ChatWindow")) {
|
||||
throw new Error("Chat window should not be visible");
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
@@ -423,16 +423,6 @@ class TestUi(odoo.tests.HttpCase):
|
||||
def test_27_website_clicks(self):
|
||||
self.start_tour('/web', 'website_click_tour', login='admin')
|
||||
|
||||
def test_28_hide_chat_window_on_preview(self):
|
||||
session = self.authenticate('admin', 'admin')
|
||||
partner_id = self.env['res.users'].search([('id', '=', session.uid)]).partner_id
|
||||
self.env['discuss.channel'].create({
|
||||
'name': 'Test Channel',
|
||||
'channel_type': 'chat',
|
||||
'channel_member_ids': [odoo.Command.create({'partner_id': partner_id.id, 'is_minimized': True})],
|
||||
})
|
||||
self.start_tour(f'/web#id={partner_id.id}&model=res.partner&view_type=form', 'test_hide_chat_window_on_preview', login='admin')
|
||||
|
||||
def test_29_website_text_edition(self):
|
||||
self.start_tour('/@/', 'website_text_edition', login='admin')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user