diff --git a/web_notify/README.rst b/web_notify/README.rst index ab0517e5..29059831 100644 --- a/web_notify/README.rst +++ b/web_notify/README.rst @@ -93,6 +93,7 @@ Contributors * Laurent Mignon * Serpent Consulting Services Pvt. Ltd. * Guewen Baconnier +* Wolfgang Pichler Maintainer ---------- diff --git a/web_notify/static/src/js/web_client.js b/web_notify/static/src/js/web_client.js index d87b52ff..88563832 100644 --- a/web_notify/static/src/js/web_client.js +++ b/web_notify/static/src/js/web_client.js @@ -44,6 +44,9 @@ WebClient.include({ ), init: function(parent, client_options){ this._super(parent, client_options); + this.channel_warning = 'notify_warning_' + this.session.uid; + this.channel_info = 'notify_info_' + this.session.uid; + }, reload_active_view: function(){ var action_manager = this.action_manager; @@ -57,23 +60,17 @@ WebClient.include({ }, show_application: function() { var res = this._super(); - this.start_polling(); + base_bus.bus.start_polling(); + base_bus.bus.add_channel(this.channel_warning); + base_bus.bus.add_channel(this.channel_info); + base_bus.bus.on('notification', this, this._web_notify_notification); return res }, on_logout: function() { - var self = this; - base_bus.bus.off('notification', this, this.bus_notification); + base_bus.bus.off('notification', this, this._web_notify_notification); this._super(); }, - start_polling: function() { - this.channel_warning = 'notify_warning_' + this.session.uid; - this.channel_info = 'notify_info_' + this.session.uid; - base_bus.bus.add_channel(this.channel_warning); - base_bus.bus.add_channel(this.channel_info); - base_bus.bus.on('notification', this, this.bus_notification); - base_bus.bus.start_polling(); - }, - bus_notification: function(notifications) { + _web_notify_notification: function (notifications) { var self = this; _.each(notifications, function (notification) { var channel = notification[0];