[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:
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user