[FIX] mail: send the correct args to the message_unsubscribe method

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) <aku@odoo.com>
This commit is contained in:
Didier (did)
2020-09-16 10:41:17 +00:00
parent 6888c2a8de
commit 711e8addf5
2 changed files with 6 additions and 5 deletions
@@ -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"
);
}
@@ -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();
}