Browse Source

[FIX] web_notify attempt to fix void messages (#1249)

It seems besides the custom channels provided in this addon it also catches messages from other channels. E.g. in this case it seems the void popup is triggered by these activity creation bus messages.

**Steps to reproduce**

Odoo commit: could reproduce on 5e8b667951 and 4da82776ff
OCA/web commit: 2465278

* Install crm and web_notify modules
* Create an activity for yourself (tried for admin user)
* Empty popup appears

**Attempt to solve**

It seems the bus handles all messages non exclusively. I've hacked in a conditional to handle only messages from web_notify addon, but its unclear wether this does not break something else.
pull/1260/head
Karolis Kalantojus 5 years ago
committed by Pedro M. Baeza
parent
commit
2169ef8e64
  1. 16
      web_notify/static/src/js/web_client.js

16
web_notify/static/src/js/web_client.js

@ -19,6 +19,13 @@ odoo.define('web_notify.WebClient', function (require) {
this.channel_warning = 'notify_warning_' + session.uid;
this.channel_info = 'notify_info_' + session.uid;
this.channel_default = 'notify_default_' + session.uid;
this.all_channels = [
this.channel_success,
this.channel_danger,
this.channel_warning,
this.channel_info,
this.channel_default,
];
this.call('bus_service', 'addChannel', this.channel_success);
this.call('bus_service', 'addChannel', this.channel_danger);
this.call('bus_service', 'addChannel', this.channel_warning);
@ -32,9 +39,14 @@ odoo.define('web_notify.WebClient', function (require) {
bus_notification: function (notifications) {
var self = this;
_.each(notifications, function (notification) {
// Not used: var channel = notification[0];
var channel = notification[0];
var message = notification[1];
self.on_message(message);
if (
self.all_channels != null &&
self.all_channels.indexOf(channel) > -1
) {
self.on_message(message);
}
});
},
on_message: function (message) {

Loading…
Cancel
Save