mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
[MIG] web_notify: Migration to 11.0
- Use the 'session' class of the JS Framework (session no lounger bound to web client) - Test change: compare emitted & received messages based on content, not order. Using string comparison raises false positives.
This commit is contained in:
@@ -3,24 +3,18 @@ odoo.define('web_notify.WebClient', function (require) {
|
||||
|
||||
var WebClient = require('web.WebClient');
|
||||
var base_bus = require('bus.bus');
|
||||
var session = require('web.session');
|
||||
|
||||
|
||||
WebClient.include({
|
||||
init: function(parent, client_options){
|
||||
this._super(parent, client_options);
|
||||
},
|
||||
show_application: function() {
|
||||
var res = this._super();
|
||||
this.start_polling();
|
||||
return res
|
||||
},
|
||||
on_logout: function() {
|
||||
var self = this;
|
||||
base_bus.bus.off('notification', this, this.bus_notification);
|
||||
this._super();
|
||||
},
|
||||
start_polling: function() {
|
||||
this.channel_warning = 'notify_warning_' + this.session.uid;
|
||||
this.channel_info = 'notify_info_' + this.session.uid;
|
||||
this.channel_warning = 'notify_warning_' + session.uid;
|
||||
this.channel_info = 'notify_info_' + 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);
|
||||
@@ -33,7 +27,7 @@ WebClient.include({
|
||||
var message = notification[1];
|
||||
if (channel === self.channel_warning) {
|
||||
self.on_message_warning(message);
|
||||
} else if (channel == self.channel_info) {
|
||||
} else if (channel === self.channel_info) {
|
||||
self.on_message_info(message);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user