From 711e8addf532add8b6e8747bf34bccb57b494c30 Mon Sep 17 00:00:00 2001 From: "Didier (did)" Date: Tue, 15 Sep 2020 13:46:44 +0000 Subject: [PATCH] [FIX] mail: send the correct args to the message_unsubscribe method MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before this commit it was not possible to remove a channel from the followers. task-2324263 closes odoo/odoo#57817 X-original-commit: 9a065048bbdd09072084d03e67fd012766ddbe23 Signed-off-by: Alexandre Kühn (aku) --- .../follower_list_menu/follower_list_menu_tests.js | 2 +- addons/mail/static/src/models/follower/follower.js | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/addons/mail/static/src/components/follower_list_menu/follower_list_menu_tests.js b/addons/mail/static/src/components/follower_list_menu/follower_list_menu_tests.js index 894a1b2cef5..cf6fcf24953 100644 --- a/addons/mail/static/src/components/follower_list_menu/follower_list_menu_tests.js +++ b/addons/mail/static/src/components/follower_list_menu/follower_list_menu_tests.js @@ -365,7 +365,7 @@ QUnit.test('click on remove follower', async function (assert) { assert.step('message_unsubscribe'); assert.deepEqual( args.args, - [[100], [self.env.messaging.currentPartner.id]], + [[100], [self.env.messaging.currentPartner.id], []], "message_unsubscribe should be called with right argument" ); } diff --git a/addons/mail/static/src/models/follower/follower.js b/addons/mail/static/src/models/follower/follower.js index 6fb83649e2e..6bc6c7f579f 100644 --- a/addons/mail/static/src/models/follower/follower.js +++ b/addons/mail/static/src/models/follower/follower.js @@ -77,16 +77,17 @@ function factory(dependencies) { * Remove this follower from its related thread. */ async remove() { - const args = [[this.followedThread.id]]; + const partner_ids = []; + const channel_ids = []; if (this.partner) { - args.push([this.partner.id]); + partner_ids.push(this.partner.id); } else { - args.push([this.channel.id]); + channel_ids.push(this.channel.id); } await this.async(() => this.env.services.rpc({ model: this.followedThread.model, method: 'message_unsubscribe', - args + args: [[this.followedThread.id], partner_ids, channel_ids] })); this.delete(); }