summaryrefslogtreecommitdiff
path: root/addons/mail/static/src
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2015-12-08 15:45:09 +0100
committerAaron Bohy <aab@odoo.com>2015-12-09 11:16:24 +0100
commit085f6e0e6872cbfe2e4ee2c8db92bef0f1f23b8c (patch)
treeb394d4af4ccc549dfee79018a35fd9e0a21c8b36 /addons/mail/static/src
parentda2b88bbbe16904cf86a94e4c8e6b12500c1b205 (diff)
[FIX] mail: multiple clicks on navbar needactions icon
Clicking on this icon redirects to the client action (for now at least). By quickly clicking several times on it, we try to restore the scroll position of a channel that not yet exists. This rev. prevents from getting a traceback in that case.
Diffstat (limited to 'addons/mail/static/src')
-rw-r--r--addons/mail/static/src/js/client_action.js4
-rw-r--r--addons/mail/static/src/js/systray.js5
2 files changed, 7 insertions, 2 deletions
diff --git a/addons/mail/static/src/js/client_action.js b/addons/mail/static/src/js/client_action.js
index fc9d73fbfb7..e06abc5a9de 100644
--- a/addons/mail/static/src/js/client_action.js
+++ b/addons/mail/static/src/js/client_action.js
@@ -120,7 +120,9 @@ var ChatAction = Widget.extend(ControlPanelMixin, {
},
on_attach_callback: function () {
- this.thread.scroll_to({offset: this.channels_scrolltop[this.channel.id]});
+ if (this.channel) {
+ this.thread.scroll_to({offset: this.channels_scrolltop[this.channel.id]});
+ }
},
on_detach_callback: function () {
this.channels_scrolltop[this.channel.id] = this.thread.get_scrolltop();
diff --git a/addons/mail/static/src/js/systray.js b/addons/mail/static/src/js/systray.js
index c5d34f179bc..19e225c364f 100644
--- a/addons/mail/static/src/js/systray.js
+++ b/addons/mail/static/src/js/systray.js
@@ -29,11 +29,14 @@ var NotificationTopButton = Widget.extend({
},
on_click: function (event) {
event.preventDefault();
+ this.discuss_redirect();
+ },
+ discuss_redirect: _.debounce(function () {
var discuss_ids = chat_manager.get_discuss_ids();
this.do_action(discuss_ids.action_id, {clear_breadcrumbs: true}).then(function () {
core.bus.trigger('change_menu_section', discuss_ids.menu_id);
});
- },
+ }, 1000, true),
});
SystrayMenu.Items.push(NotificationTopButton);