[FIX] im_livechat: notify operator on leave channel for sharable support
when we are using the sharable support page (url : "/im_livechat/support/"), There is no "visitor left" message sent to the operator when any visitor left the channel. Ideally, when any visitor left the channel from the website or the support page should notify the operator that "Visitor has left the conversation". With this commit, the operator will get notified every time when visitor left the conversation from anywhere. Task-2210040 closes odoo/odoo#87414 X-original-commit: 8c6affdb7a59436c6fdba1ad0a7c68a7273c0468 Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com> Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
This commit is contained in:
committed by
Alexandre Kühn
parent
55a6f2e996
commit
60fc564b3e
@@ -421,6 +421,7 @@ var LivechatButton = Widget.extend({
|
||||
} else {
|
||||
this._closeChat();
|
||||
}
|
||||
this._visitorLeaveSession();
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
@@ -470,6 +471,19 @@ var LivechatButton = Widget.extend({
|
||||
ev.stopPropagation();
|
||||
this._chatWindow.renderHeader();
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* Called when the visitor leaves the livechat chatter the first time (first click on X button)
|
||||
* this will deactivate the mail_channel, notify operator that visitor has left the channel.
|
||||
*/
|
||||
_visitorLeaveSession: function () {
|
||||
var cookie = utils.get_cookie('im_livechat_session');
|
||||
if (cookie) {
|
||||
var channel = JSON.parse(cookie);
|
||||
session.rpc('/im_livechat/visitor_leave_session', {uuid: channel.uuid});
|
||||
utils.set_cookie('im_livechat_session', "", -1); // remove cookie
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
/*
|
||||
|
||||
@@ -2,7 +2,6 @@ odoo.define('website_livechat.legacy.website_livechat.livechat_request', functio
|
||||
"use strict";
|
||||
|
||||
var utils = require('web.utils');
|
||||
var session = require('web.session');
|
||||
var LivechatButton = require('im_livechat.legacy.im_livechat.im_livechat').LivechatButton;
|
||||
const config = require('web.config');
|
||||
|
||||
@@ -42,26 +41,6 @@ LivechatButton.include({
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Handlers
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* @override
|
||||
* Called when the visitor closes the livechat chatter the first time (first click on X button)
|
||||
* this will deactivate the mail_channel, clean the chat request if any
|
||||
* and allow the operators to send the visitor a new chat request
|
||||
*/
|
||||
_onCloseChatWindow: function (ev) {
|
||||
this._super(ev);
|
||||
var cookie = utils.get_cookie('im_livechat_session');
|
||||
if (cookie) {
|
||||
var channel = JSON.parse(cookie);
|
||||
session.rpc('/im_livechat/visitor_leave_session', {uuid: channel.uuid});
|
||||
utils.set_cookie('im_livechat_session', "", -1); // remove cookie
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user