[FIX] im_livechat: make /history command work for public user
Have the public user (not logged in -- user B) having a live chat with any logged in user (user A) Having in mind that: - (A) issues /history in his chatter to see where (B) has gone on the website - The bus sends a kind of a "pull cookie request" on each clients - The browser of (B) retrieves the cookie info and calls the relevant route - That route sends the transient message for (A) Before this commit: The command did not work because the user of the route we end up on is the public one hence, the search for the channel would not yield anything After this commit: The command does work as expected OPW 1818732 closes #23485
This commit is contained in:
@@ -110,7 +110,8 @@ class LivechatController(http.Controller):
|
||||
|
||||
@http.route('/im_livechat/history', type="json", auth="public")
|
||||
def history_pages(self, pid, channel_uuid, page_history=None):
|
||||
channel = request.env['mail.channel'].search([('uuid', '=', channel_uuid)])
|
||||
partner_ids = (pid, request.env.user.partner_id.id)
|
||||
channel = request.env['mail.channel'].sudo().search([('uuid', '=', channel_uuid), ('channel_partner_ids', 'in', partner_ids)])
|
||||
if channel:
|
||||
channel._send_history_message(pid, page_history)
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user