addons/portal_rating/static/src/chatter/frontend/thread_model_patch.js
raw| 1 | import { Thread } from "@mail/core/common/thread_model"; |
| 2 | |
| 3 | import { patch } from "@web/core/utils/patch"; |
| 4 | |
| 5 | patch(Thread.prototype, { |
| 6 | setup() { |
| 7 | super.setup(); |
| 8 | this.selectedRating; |
| 9 | this.rating_stats; |
| 10 | }, |
| 11 | |
| 12 | getFetchParams() { |
| 13 | const params = super.getFetchParams(...arguments); |
| 14 | if (this.model !== "discuss.channel") { |
| 15 | params["rating_include"] = true; |
| 16 | if (this.selectedRating) { |
| 17 | params["rating_value"] = this.selectedRating; |
| 18 | } |
| 19 | } |
| 20 | return params; |
| 21 | }, |
| 22 | }); |