summaryrefslogtreecommitdiff
path: root/addons/im_support/static/src/js
diff options
context:
space:
mode:
authorOlivier Dony <odo@odoo.com>2019-10-11 09:15:10 +0000
committerfw-bot <otis@odoo.com>2019-10-15 17:43:19 +0000
commitae82f17cc9e4c025b2545dd2750981e378ed0804 (patch)
tree3c9f6ee35be86d96db9db34920565826e5f22d43 /addons/im_support/static/src/js
parent607085166deba939abb6f3d8d2aa9ad5b0b7a33b (diff)
[FIX] bus,im_support: adapt im_support to bus changes
The im_support module was broken in 12.0 after bus refactorings between 11.0 and 12.0. closes odoo/odoo#38838 X-original-commit: db37e0cedcd0da46bd57686a076a8165e60d6c3b Signed-off-by: Olivier Dony (odo) <odo@openerp.com> Co-authored-by: @alexkuhn
Diffstat (limited to 'addons/im_support/static/src/js')
-rw-r--r--addons/im_support/static/src/js/support_bus.js8
-rw-r--r--addons/im_support/static/src/js/support_channel.js46
-rw-r--r--addons/im_support/static/src/js/systray_messaging_menu.js3
3 files changed, 33 insertions, 24 deletions
diff --git a/addons/im_support/static/src/js/support_bus.js b/addons/im_support/static/src/js/support_bus.js
index bb7c3386780..ed0d22c1257 100644
--- a/addons/im_support/static/src/js/support_bus.js
+++ b/addons/im_support/static/src/js/support_bus.js
@@ -13,8 +13,12 @@ var core = require('web.core');
var SupportBusService = BusService.extend({
LOCAL_STORAGE_PREFIX: 'im_support',
POLL_ROUTE: '/longpolling/support_poll',
- getSession: function () {
- return supportSession;
+
+ /**
+ * @override _makePoll to force the remote session
+ */
+ _makePoll: function(data) {
+ return supportSession.rpc(this.POLL_ROUTE, data, {shadow : true, timeout: 60000});
},
});
diff --git a/addons/im_support/static/src/js/support_channel.js b/addons/im_support/static/src/js/support_channel.js
index 8a3fae912f9..402b590919f 100644
--- a/addons/im_support/static/src/js/support_channel.js
+++ b/addons/im_support/static/src/js/support_channel.js
@@ -213,37 +213,41 @@ var SupportChannel = SearchableThread.extend({
* @override
* @private
*/
- _fetchMessages: function (channel, options) {
+ _fetchMessages: function (pDomain, loadMore) {
var self = this;
- var domain = options && options.domain || [];
- var cache = this._getCache(channel, domain);
- if (options && options.loadMore) {
- var minMessageID = cache.messages[0].id;
+ var domain = [];
+ var cache = this._getCache(pDomain);
+ if (pDomain) {
+ domain = domain.concat(pDomain || []);
+ }
+ if (loadMore) {
+ // ignore the welcome message (ID==-1)
+ var msgs = cache.messages.filter(function(m) {return m.getID() !== -1});
+ var minMessageID = msgs[0].getID();
domain = [['id', '<', minMessageID]].concat(domain);
}
-
return supportSession.rpc('/odoo_im_support/fetch_messages', {
domain: domain,
channel_uuid: session.support_token,
limit: self._FETCH_LIMIT,
- }).then(function (msgs) {
- if (!cache.all_history_loaded) {
- cache.all_history_loaded = msgs.length < self._FETCH_LIMIT;
- }
- cache.loaded = true;
-
- _.each(msgs, function (msg) {
- _.extend(msg, {channel_ids: [self.getID()]});
- self.call('mail_service', 'addMessage', msg, {
- channel_id: self.getID(),
- silent: true,
- domain: domain,
- });
+ }).then(function (messages) {
+ if (!cache.allHistoryLoaded) {
+ cache.allHistoryLoaded = messages.length < self._FETCH_LIMIT;
+ }
+ cache.loaded = true;
+ _.each(messages, function (message) {
+ message.channel_ids = [self.getID()];
+ message.channel_id = self.getID();
+ self.call('mail_service', 'addMessage', message, {
+ silent: true,
+ domain: pDomain,
});
- var channelCache = self._getCache(channel, domain);
- return channelCache.messages;
});
+ cache = self._getCache(pDomain || []);
+ return cache.messages;
+ });
},
+
/**
* Posts the message on the Support server.
*
diff --git a/addons/im_support/static/src/js/systray_messaging_menu.js b/addons/im_support/static/src/js/systray_messaging_menu.js
index c6779dfbb4e..faec67fbb9d 100644
--- a/addons/im_support/static/src/js/systray_messaging_menu.js
+++ b/addons/im_support/static/src/js/systray_messaging_menu.js
@@ -27,7 +27,8 @@ MessagingMenu.include({
this._super.apply(this, arguments);
this.supportChannel = {
id: SUPPORT_CHANNEL_ID,
- name: _t("Support"),
+ name: _t("Odoo Live Support"),
+ title: _t("Odoo Live Support"),
imageSRC: '/mail/static/src/img/odoo_o.png',
};
},