[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.
This commit is contained in:
Aaron Bohy
2015-12-09 11:16:24 +01:00
parent da2b88bbbe
commit 085f6e0e68
2 changed files with 7 additions and 2 deletions
+3 -1
View File
@@ -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();
+4 -1
View File
@@ -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);