Debian Codegraph @

addons/portal_rating/static/src/chatter/frontend/chatter_patch.js

raw
1 import { Chatter } from "@mail/chatter/web_portal/chatter";
2 import { patch } from "@web/core/utils/patch";
3
4 const chatterPatch = {
5 async onClickStarDomain(star) {
6 const { thread } = this.state;
7 Object.assign(thread, {
8 loadOlder: false,
9 rating_stats: this.ratingStats,
10 selectedRating: star,
11 });
12 thread.messages = await thread.fetchMessages();
13 thread.loadOlder = thread.messages.length === this.store.FETCH_LIMIT;
14 },
15
16 async onClickStarDomainReset() {
17 const { thread } = this.state;
18 Object.assign(thread, {
19 loadOlder: false,
20 selectedRating: false,
21 });
22 thread.messages = await thread.fetchMessages();
23 thread.loadOlder = thread.messages.length === this.store.FETCH_LIMIT;
24 },
25
26 get ratingStats() {
27 return this.state.thread?.messages.at(-1)?.rating_stats || this.state.thread?.rating_stats;
28 },
29 };
30
31 patch(Chatter.prototype, chatterPatch);