diff options
| author | Sébastien Theys <seb@odoo.com> | 2020-08-24 10:37:47 +0000 |
|---|---|---|
| committer | Sébastien Theys <seb@odoo.com> | 2020-08-24 13:21:45 +0000 |
| commit | 72b9335334c076d8deaa36e404feaa3f4d30c351 (patch) | |
| tree | aea8c816b33d89b409fedbc75bcca3d2d6597717 /addons/mail/static/src/models/messaging_notification_handler | |
| parent | 0834d241624330ab3fd3925366a3217fe8145dfc (diff) | |
[FIX] mail, im_livechat: make livechat work properly
- fix traceback on receiving first livechat message due to bad computation of
correspondent
- fix missing [0] in return of country name_get in channel_info
- fix visitor/correspondent computation to work when chatting with oneself
- reintroduce livechat ordered by last message in discuss sidebar
- improve mock server to make these fixes possible to test
- introduce corresponding tests
PR: #56243
task-2323670
closes odoo/odoo#56414
X-original-commit: f623bfd2c8819604c709bc723153c071dca6e3cc
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Diffstat (limited to 'addons/mail/static/src/models/messaging_notification_handler')
| -rw-r--r-- | addons/mail/static/src/models/messaging_notification_handler/messaging_notification_handler.js | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/addons/mail/static/src/models/messaging_notification_handler/messaging_notification_handler.js b/addons/mail/static/src/models/messaging_notification_handler/messaging_notification_handler.js index 49f07bc5423..d89992d8a4b 100644 --- a/addons/mail/static/src/models/messaging_notification_handler/messaging_notification_handler.js +++ b/addons/mail/static/src/models/messaging_notification_handler/messaging_notification_handler.js @@ -56,7 +56,7 @@ function factory(dependencies) { /** * @private * @param {Object[]} notifications - * @param {Array} notifications[i][0] meta-data of the notification. + * @param {Array|string} notifications[i][0] meta-data of the notification. * @param {string} notifications[i][0][0] name of database this * notification comes from. * @param {string} notifications[i][0][1] type of notification. @@ -68,20 +68,25 @@ function factory(dependencies) { async _handleNotifications(notifications) { const filteredNotifications = this._filterNotificationsOnUnsubscribe(notifications); const proms = filteredNotifications.map(notification => { - const [[, model, id], data] = notification; + const [channel, message] = notification; + if (typeof channel === 'string') { + // uuid notification, only for (livechat) public handler + return; + } + const [, model, id] = channel; switch (model) { case 'ir.needaction': - return this._handleNotificationNeedaction(data); + return this._handleNotificationNeedaction(message); case 'mail.channel': return this._handleNotificationChannel(Object.assign({ channelId: id, - }, data)); + }, message)); case 'res.partner': if (id !== this.env.messaging.currentPartner.id) { // ignore broadcast to other partners return; } - return this._handleNotificationPartner(Object.assign({}, data)); + return this._handleNotificationPartner(Object.assign({}, message)); default: console.warn(`mail.messaging_notification_handler: Unhandled notification "${model}"`); return; |
