From f9ead39f5f8d0d2bdeeab5c10b12d26ae323b117 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20K=C3=BChn?= Date: Mon, 8 Jul 2019 07:56:38 +0000 Subject: [PATCH] [FIX] mail: rename direct message chat Before this commit, when a direct message chat was renamed, it crashed with the following error: `TypeError: Cannot read property 'toLowerCase' of undefined` This occurs because the name of the dm chat changed from the RPC response. However, no new name was provided, thus it sets its name to `undefined`. Test has been adapted in order to reflect that the server does not response with new name after RPC `channel_set_custom_name`. closes odoo/odoo#34641 Signed-off-by: Martin Geubelle (mge) --- addons/mail/static/src/js/discuss.js | 4 ++-- addons/mail/static/tests/discuss_tests.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/mail/static/src/js/discuss.js b/addons/mail/static/src/js/discuss.js index 0e3b66dd720..5b1405e72e8 100644 --- a/addons/mail/static/src/js/discuss.js +++ b/addons/mail/static/src/js/discuss.js @@ -168,9 +168,9 @@ var RenameConversationDialog = Dialog.extend({ kwargs: { name: name, } - }).then(function (updatedName) { + }).then(function () { var channel = self.call('mail_service', 'getThread', self._channelID); - channel.setName(updatedName); + channel.setName(name); self._callback(); }); }, diff --git a/addons/mail/static/tests/discuss_tests.js b/addons/mail/static/tests/discuss_tests.js index 9b63a9dc7d5..6cbcf471b15 100644 --- a/addons/mail/static/tests/discuss_tests.js +++ b/addons/mail/static/tests/discuss_tests.js @@ -1507,7 +1507,7 @@ QUnit.test('rename DM conversation', function (assert) { assert.step(args.method); assert.strictEqual(args.args[0], 1); assert.strictEqual(args.kwargs.name, "Demo"); - return $.when("Demo"); + return $.when(); } return this._super.apply(this, arguments); },