[FIX] mail: reading property from undefined

To Reproduce
============
- add event on calendar
- edit the event and remove the user from participants list and add another one.
- save the record -> traceback

Problem
=======
we try to read `hasReadAccess` from `this.followedThread` that is `null` in this case.

Solution
========
check if `this.followedThread` is `null` or not

opw-3126545

closes odoo/odoo#109721

X-original-commit: f9a23af63bb5fe882f0d42f06ef1406910836115
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
Abdelouahab (abla)
2023-01-12 12:27:15 +01:00
parent 553703cc02
commit 798b4f76c4
+4 -1
View File
@@ -169,8 +169,11 @@ Model({
const hasWriteAccess = this.followedThread
? this.followedThread.hasWriteAccess
: false;
return this.messaging.currentPartner === this.partner
const hasReadAccess = this.followedThread
? this.followedThread.hasReadAccess
: false;
return this.messaging.currentPartner === this.partner
? hasReadAccess
: hasWriteAccess;
},
}),