[FIX] mail: fix public page for non internal users

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) <seb@odoo.com>
Signed-off-by: Matthieu Stockbauer (tsm) <tsm@odoo.com>
This commit is contained in:
tsm-odoo
2023-10-23 09:05:10 +00:00
parent 25e9de8c71
commit ffb8f83159
2 changed files with 3 additions and 1 deletions
@@ -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") {
@@ -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])