summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/js/thread_windows/thread_window.js
diff options
context:
space:
mode:
authorAlexandre Kühn <aku@odoo.com>2020-01-29 16:26:28 +0000
committerAlexandre Kühn <aku@odoo.com>2020-01-30 15:23:02 +0000
commitf61b4669a9607c3cb800d5ec33ab0001086f2d97 (patch)
treead12b67b70f4ee1f86ada4c7c582184afcb6f211 /addons/mail/static/src/js/thread_windows/thread_window.js
parentcd70571d84eefd38084bd599dfbdd46bde391074 (diff)
[FIX] mail: no traceback on click channel mention from chat window
Before this commit, when clicking on a channel mention from a chat window, it crashed with the following error: `TypeError: channel.detach is not a function` This happens due to `MailService.joinChannel()` returning a promise that is resolved with channel ID, instead of a channel object. `channel.detach()` becomes `<Number>.detach()`, which is treated like `undefined()`, hence crash. closes odoo/odoo#44329 X-original-commit: 710fda06c3b30ff2267fcc1d123f15ce031b6f3a Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Diffstat (limited to 'addons/mail/static/src/js/thread_windows/thread_window.js')
-rw-r--r--addons/mail/static/src/js/thread_windows/thread_window.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/addons/mail/static/src/js/thread_windows/thread_window.js b/addons/mail/static/src/js/thread_windows/thread_window.js
index 8b4eb03d9db..f7f0c23dd7b 100644
--- a/addons/mail/static/src/js/thread_windows/thread_window.js
+++ b/addons/mail/static/src/js/thread_windows/thread_window.js
@@ -351,10 +351,12 @@ var ThreadWindow = AbstractThreadWindow.extend({
* @param {integer} channelID
*/
_onRedirectToChannel: function (channelID) {
+ var self = this;
var thread = this.call('mail_service', 'getThread', channelID);
if (!thread) {
this.call('mail_service', 'joinChannel', channelID)
- .then(function (channel) {
+ .then(function (channelID) {
+ var channel = self.call('mail_service', 'getThread', channelID);
channel.detach();
});
} else {