summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/models/thread/thread.js
diff options
context:
space:
mode:
authorPriyanka Kakadiya <pka@odoo.com>2020-07-13 13:22:34 +0000
committerPriyanka Kakadiya <pka@odoo.com>2020-08-17 11:56:46 +0000
commit2b06be68600b5a15b5c2e3500b2e05394c966535 (patch)
treece9dfcdaf1ac1d5e1fe9f13df17dd688a2037101 /addons/mail/static/src/models/thread/thread.js
parentecb1d732c643a611bf2074755fef57a1da7ab723 (diff)
[IMP] mail: improve followers refreshed on thread
PURPOSE Currently it does two RPCs to refresh followers on thread: 1) To get follower ids 2) To get followers detail SPECIFICATION While refreshing followers on the thread, perform only one RPC call. LINKS Task-2243180 PR https://github.com/odoo/odoo/pull/54437 closes odoo/odoo#55989 X-original-commit: 1fd445fb55810b97ed7a6dfe694e471891c6a3bc Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Diffstat (limited to 'addons/mail/static/src/models/thread/thread.js')
-rw-r--r--addons/mail/static/src/models/thread/thread.js20
1 files changed, 7 insertions, 13 deletions
diff --git a/addons/mail/static/src/models/thread/thread.js b/addons/mail/static/src/models/thread/thread.js
index 56bdfd36138..92da6ca9197 100644
--- a/addons/mail/static/src/models/thread/thread.js
+++ b/addons/mail/static/src/models/thread/thread.js
@@ -576,20 +576,14 @@ function factory(dependencies) {
this.update({ followers: [['unlink-all']] });
return;
}
- // FIXME Do that with only one RPC (see task-2243180)
- const [{ message_follower_ids: followerIds }] = await this.async(() => this.env.services.rpc({
- model: this.model,
- method: 'read',
- args: [this.id, ['message_follower_ids']],
+ const { followers } = await this.async(() => this.env.services.rpc({
+ route: '/mail/read_followers',
+ params: {
+ res_id: this.id,
+ res_model: this.model,
+ },
}));
- if (followerIds && followerIds.length > 0) {
- const { followers } = await this.async(() => this.env.services.rpc({
- route: '/mail/read_followers',
- params: {
- follower_ids: followerIds,
- context: {}, // FIXME empty context to be overridden in session.js with 'allowed_company_ids' task-2243187
- }
- }));
+ if (followers.length > 0) {
this.update({
followers: [['insert-and-replace', followers.map(data =>
this.env.models['mail.follower'].convertData(data))