From 94845bb63fb4d5cb32b6e2ceee52ea5123bcbe88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Theys?= Date: Wed, 8 Mar 2023 12:30:58 +0000 Subject: [PATCH] [FIX] mail: allow non-internal users to create chat from token MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Follow up of https://github.com/odoo/odoo/pull/90415 After removing the public field, the equivalent access is to set the allowed group to empty. closes odoo/odoo#114729 X-original-commit: fcafd602dda4f896ac8b91c81c00ee723afd6634 Signed-off-by: Alexandre Kühn (aku) Signed-off-by: Sébastien Theys (seb) --- addons/mail/controllers/discuss.py | 1 + addons/mail/tests/test_mail_channel_as_guest.py | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/addons/mail/controllers/discuss.py b/addons/mail/controllers/discuss.py index 03b794aeac0..8c46a700839 100644 --- a/addons/mail/controllers/discuss.py +++ b/addons/mail/controllers/discuss.py @@ -56,6 +56,7 @@ class DiscussController(http.Controller): channel_sudo = channel_sudo.create({ 'channel_type': 'channel', 'default_display_mode': default_display_mode, + 'group_public_id': None, 'name': channel_name or create_token, 'uuid': create_token, }) diff --git a/addons/mail/tests/test_mail_channel_as_guest.py b/addons/mail/tests/test_mail_channel_as_guest.py index bc4c72acdee..bb4e3ccd077 100644 --- a/addons/mail/tests/test_mail_channel_as_guest.py +++ b/addons/mail/tests/test_mail_channel_as_guest.py @@ -77,3 +77,9 @@ class TestMailPublicPage(HttpCase): def test_mail_group_public_page_as_portal(self): self._open_group_page_as_user('portal') + + def test_chat_from_token_as_guest(self): + self.env['ir.config_parameter'].set_param('mail.chat_from_token', True) + self.url_open('/chat/xyz') + channel = self.env['mail.channel'].search([('uuid', '=', 'xyz')]) + self.assertEqual(len(channel), 1)