oca-ocb-project/odoo-bringout-oca-ocb-project/project/static/src/project_sharing/chatter/chatter_patch.js
Ernad Husremovic 4a4d12c333 19.0 vanilla
2026-03-09 09:31:56 +01:00

39 lines
1.1 KiB
JavaScript

import { Chatter } from "@mail/chatter/web_portal/chatter";
import { useSubEnv } from "@odoo/owl";
import { patch } from "@web/core/utils/patch";
import { useService } from "@web/core/utils/hooks";
patch(Chatter.prototype, {
setup() {
super.setup(...arguments);
Object.assign(this.state, {
isFollower: this.props.isFollower,
});
this.orm = useService("orm");
useSubEnv({
// 'inFrontendPortalChatter' is specific to the frontend portal chatters
// and should not be set to 'true' in the project sharing chatter environment.
projectSharingId: this.props.projectSharingId,
});
},
async toggleIsFollower() {
this.state.isFollower = await this.orm.call(
this.props.threadModel,
"project_sharing_toggle_is_follower",
[this.props.threadId]
);
},
onPostCallback() {
super.onPostCallback();
this.state.isFollower = true;
},
});
Chatter.props = [
...Chatter.props,
"token",
"projectSharingId",
"isFollower",
"displayFollowButton",
];