From ffb8f83159f92cae60d45cdbee9cbe43f95981ae Mon Sep 17 00:00:00 2001 From: tsm-odoo Date: Fri, 20 Oct 2023 15:27:34 +0200 Subject: [PATCH] [FIX] mail: fix public page for non internal users MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before this commit, an error occured when opening the discuss public page as a non internal user. This is caused by a read rpc being done while the user is not allowed to do it. This commit ensures this rpc is only done when allowed. Steps to reproduce the issue: - Open Odoo with Mitchell Admin - Go to a public channel - Start a RTC call - Join the channel as guest with the invitation link - A pop up appears closes odoo/odoo#139397 X-original-commit: c7e66f3878b451001dbe4e8e3cdd8ced9a8ed632 Signed-off-by: Sébastien Theys (seb) Signed-off-by: Matthieu Stockbauer (tsm) --- addons/mail/static/src/core/common/thread_service.js | 2 +- addons/mail/tests/discuss/test_discuss_channel_as_guest.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/mail/static/src/core/common/thread_service.js b/addons/mail/static/src/core/common/thread_service.js index 768b9f1d0e0..fdacc86d1fe 100644 --- a/addons/mail/static/src/core/common/thread_service.js +++ b/addons/mail/static/src/core/common/thread_service.js @@ -877,7 +877,7 @@ export class ThreadService { if (!persona) { return DEFAULT_AVATAR; } - if (persona.is_company === undefined) { + if (persona.is_company === undefined && this.store.self?.user?.isInternalUser) { this.personaService.fetchIsCompany(persona); } if (thread?.model === "discuss.channel") { diff --git a/addons/mail/tests/discuss/test_discuss_channel_as_guest.py b/addons/mail/tests/discuss/test_discuss_channel_as_guest.py index 78a92c8a533..d1b3216aafb 100644 --- a/addons/mail/tests/discuss/test_discuss_channel_as_guest.py +++ b/addons/mail/tests/discuss/test_discuss_channel_as_guest.py @@ -33,6 +33,8 @@ class TestMailPublicPage(HttpCase): self.channel.add_members(portal_user.partner_id.ids) self.channel.add_members(internal_user.partner_id.ids) self.channel.add_members(guest_ids=[guest.id]) + internal_member = self.channel.channel_member_ids.filtered(lambda m: internal_user.partner_id == m.partner_id) + internal_member._rtc_join_call() self.group = self.env['discuss.channel'].create_group(partners_to=(internal_user + portal_user).partner_id.ids, name="Test group") self.group.add_members(guest_ids=[guest.id])