Skip to content

Commit

Permalink
[FIX] mail: avoid crash for hidden chat windows without channel
Browse files Browse the repository at this point in the history
Steps to reproduce
==================

- Install Time Off
- With Mitchell Admin, set notifications to "Handle in Odoo"
- With Marc Demo, create a few Holidays requests
- Switch back to Mitchell Admin
- Open enough chat windows from the menu in the navbar so that it fills
  the entire window

When there is no place left, we get this error

```
Cannot read properties of undefined (reading 'localMessageUnreadCounter')
```

Cause of the issue
==================

Threads related to time off have no channel

opw-3204260

closes odoo#120418

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
  • Loading branch information
hubvd committed May 3, 2023
1 parent 25e2532 commit bff9cb7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion addons/mail/static/src/models/chat_window_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ registerModel({
);
let amount = 0;
for (const chatWindow of allHiddenWithThread) {
if (chatWindow.thread.channel.localMessageUnreadCounter > 0) {
if (chatWindow.thread.channel && chatWindow.thread.channel.localMessageUnreadCounter > 0) {
amount++;
}
}
Expand Down

0 comments on commit bff9cb7

Please sign in to comment.