[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
This commit is contained in:
Xavier BOL (xbo)
2021-08-26 14:59:33 +02:00
parent a8af1361e5
commit bad706d34c
@@ -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 $('<div/>');
}
return this._makeChatterContainerTarget();
}
}
return this._super(...arguments);
},
});