[REF] mail, im_livechat: move /mail/chat_history to im_livechat

It is only used there.

In preparation of splitting discuss and mail modules.

Part of task-3265211

closes odoo/odoo#119302

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
Sébastien Theys
2023-04-22 05:51:59 +02:00
parent a1fcb6ffe6
commit bcce4be8e9
3 changed files with 9 additions and 9 deletions
+8
View File
@@ -211,3 +211,11 @@ class LivechatController(http.Controller):
discuss_channel = request.env['discuss.channel'].sudo().search([('uuid', '=', uuid)])
if discuss_channel:
discuss_channel._close_livechat_session()
@http.route(['/im_livechat/chat_history'], type="json", auth="public", cors="*")
def im_livechat_chat_history(self, uuid, last_id=False, limit=20):
channel = request.env["discuss.channel"].sudo().search([('uuid', '=', uuid)], limit=1)
if not channel:
return []
else:
return channel._channel_fetch_message(last_id, limit)
@@ -52,7 +52,7 @@ Model({
const cookie = JSON.parse(strCookie || "{}");
if (cookie.id) {
const history = await this.messaging.rpc({
route: "/mail/chat_history",
route: "/im_livechat/chat_history",
params: { uuid: cookie.uuid, limit: 100 },
});
history.reverse();
-8
View File
@@ -35,11 +35,3 @@ class MailChatController(BusController):
subtype_xmlid='mail.mt_comment'
)
return message.id if message else False
@route(['/mail/chat_history'], type="json", auth="public", cors="*")
def mail_chat_history(self, uuid, last_id=False, limit=20):
channel = request.env["discuss.channel"].sudo().search([('uuid', '=', uuid)], limit=1)
if not channel:
return []
else:
return channel._channel_fetch_message(last_id, limit)