[FIX] mail: prevents crash in some channelMember inserts

Before this commit, we were trying to access
`channelMember.thread.channelMembers` when inserting a member, but
some inserts come without this key.

A traceback could occur when inserts of `rtcSession` records came
with a `channelMember` with little information on their thread.

closes odoo/odoo#116656

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
Thanh Dodeur
2023-03-27 12:47:23 +02:00
parent a6a7cd83f9
commit 49ff78711e
@@ -37,7 +37,7 @@ export class ChannelMemberService {
switch (command) {
case "insert":
{
if (!member.thread.channelMembers.includes(member)) {
if (!member.thread?.channelMembers?.includes(member)) {
member.thread.channelMembers.push(member);
}
}