Skip to content

Commit

Permalink
[FIX] Room creation error due absence of subscriptions (#11178)
Browse files Browse the repository at this point in the history
Fixes the following error:

```
Uncaught TypeError: Cannot read property 'name' of undefined
    at roomList.js:127
    at callbacks.js:97
    at Array.reduce (<anonymous>)
    at Object.RocketChat.callbacks.run (callbacks.js:88)
    at Streamer.<anonymous> (cachedCollection.js:340)
    at ev.js:11
    at Array.forEach (<anonymous>)
    at Streamer.emit (ev.js:11)
    at StreamerCentral.<anonymous> (client.js:66)
    at ev.js:11
```
  • Loading branch information
tassoevan authored and ggazzo committed Jun 18, 2018
1 parent 9b0e198 commit add48ca
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/rocketchat-ui-sidenav/client/roomList.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ const mergeSubRoom = (record/*, t*/) => {

RocketChat.callbacks.add('cachedCollection-received-rooms', (room) => {
const sub = RocketChat.models.Subscriptions.findOne({ rid: room._id });
if (!sub) {
return;
}
const $set = {lastMessage : room.lastMessage, lm: room._updatedAt, ...getLowerCaseNames(room, sub.name)};
RocketChat.models.Subscriptions.update({ rid: room._id }, {$set});
});
Expand Down

0 comments on commit add48ca

Please sign in to comment.