[FIX] mail: websocket HTTP routes for guests

When contacting the server through the /websocket route, self.env.uid is
never set for the public user as we don't go through the
`_auth_method_public` method.

But through HTTP, it is set which is why guests were not subscribed to
their channels as their self.env.uid corresponded to the public user.

So we use request.session.uid instead, which remains unset for public
users.

closes odoo/odoo#114659

X-original-commit: 7059fdd2c8c36d6741d943ac2b61e971a4d05dcf
Signed-off-by: Denis Vermylen (dve) <dve@odoo.com>
This commit is contained in:
Denis Vermylen
2023-03-08 12:42:06 +01:00
parent d8a1928593
commit 30cd409d22
+1 -1
View File
@@ -24,7 +24,7 @@ class IrWebsocket(models.AbstractModel):
channels = list(channels) # do not alter original list
guest_sudo = self.env['mail.guest']._get_guest_from_request(req).sudo()
mail_channels = self.env['mail.channel']
if self.env.uid:
if req.session.uid:
partner = self.env.user.partner_id
mail_channels = partner.channel_ids
channels.append(partner)