From bad706d34c0e84024cbea897be065a7d67a99998 Mon Sep 17 00:00:00 2001 From: "Xavier BOL (xbo)" Date: Tue, 3 Aug 2021 14:08:28 +0200 Subject: [PATCH] [IMP] project: check if the chatter is visible before mounting it Before this commit, if we put an invisible in attrs of div tag for the chatter, the attrs is not taken into account because when the chatter is mounting this div is replaced. This commit changes the class for the chatter in project sharing and check if the div is visible before mounting the chatter. task-2379518 closes #73341 --- .../src/project_sharing/views/form/renderer.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/addons/project/static/src/project_sharing/views/form/renderer.js b/addons/project/static/src/project_sharing/views/form/renderer.js index 1ac113fbd7f..f4acf457a66 100644 --- a/addons/project/static/src/project_sharing/views/form/renderer.js +++ b/addons/project/static/src/project_sharing/views/form/renderer.js @@ -33,4 +33,22 @@ export default FormRenderer.extend({ _mountChatterContainerComponent() { this._chatterContainerComponent.appendTo(this._chatterContainerTarget); }, + _renderNode(node) { + if (node.tag === 'div' && node.attrs.class === 'oe_project_sharing_chatter') { + let isVisible = true; + if (node.attrs.modifiers && node.attrs.modifiers.invisible) { + const record = this._getRecord(this.state.id); + if (record) { + isVisible = !record.evalModifiers(node.attrs.modifiers).invisible; + } + } + if (isVisible) { + if (this._isFromFormViewDialog) { + return $('
'); + } + return this._makeChatterContainerTarget(); + } + } + return this._super(...arguments); + }, });