summaryrefslogtreecommitdiff
path: root/addons/mail/controllers/bus.py
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2017-11-09 16:49:41 +0100
committerChristophe Simonis <chs@odoo.com>2017-11-09 16:49:41 +0100
commit90ca8720717bdfd670a887bb01efbbb4be7afa2f (patch)
treed21b7bccaa7528ca1f780e2ff70e6c3617a75ead /addons/mail/controllers/bus.py
parentdb4886d511417dd2d74bd679792c6eba337917fc (diff)
parentd171f282c37e7313e9714cd58a811bd8c5d9ec0d (diff)
[MERGE] forward port branch saas-14 up to d171f282c37
Diffstat (limited to 'addons/mail/controllers/bus.py')
-rw-r--r--addons/mail/controllers/bus.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/addons/mail/controllers/bus.py b/addons/mail/controllers/bus.py
index 517ded468cd..62a5225cfe5 100644
--- a/addons/mail/controllers/bus.py
+++ b/addons/mail/controllers/bus.py
@@ -36,18 +36,16 @@ class MailChatController(BusController):
# --------------------------
@route('/mail/chat_post', type="json", auth="none")
def mail_chat_post(self, uuid, message_content, **kwargs):
- request_uid = self._default_request_uid()
# find the author from the user session, which can be None
author_id = False # message_post accept 'False' author_id, but not 'None'
if request.session.uid:
author_id = request.env['res.users'].sudo().browse(request.session.uid).partner_id.id
# post a message without adding followers to the channel. email_from=False avoid to get author from email data
- mail_channel = request.env["mail.channel"].sudo(request_uid).search([('uuid', '=', uuid)], limit=1)
- message = mail_channel.sudo(request_uid).with_context(mail_create_nosubscribe=True).message_post(author_id=author_id, email_from=False, body=message_content, message_type='comment', subtype='mail.mt_comment', content_subtype='plaintext', **kwargs)
+ mail_channel = request.env["mail.channel"].sudo().search([('uuid', '=', uuid)], limit=1)
+ message = mail_channel.sudo().with_context(mail_create_nosubscribe=True).message_post(author_id=author_id, email_from=False, body=message_content, message_type='comment', subtype='mail.mt_comment', content_subtype='plaintext')
return message and message.id or False
@route(['/mail/chat_history'], type="json", auth="none")
def mail_chat_history(self, uuid, last_id=False, limit=20):
- request_uid = self._default_request_uid()
- channel = request.env["mail.channel"].sudo(request_uid).search([('uuid', '=', uuid)], limit=1)
- return channel.sudo(request_uid).channel_fetch_message(last_id, limit)
+ channel = request.env["mail.channel"].sudo().search([('uuid', '=', uuid)], limit=1)
+ return channel.sudo().channel_fetch_message(last_id, limit)