Skip to content
Snippets Groups Projects
Commit add48cae authored by Tasso Evangelista's avatar Tasso Evangelista Committed by Guilherme Gazzo
Browse files

[FIX] Room creation error due absence of subscriptions (#11178)

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
```
parent 9b0e1980
No related branches found
No related tags found
No related merge requests found
......@@ -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});
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment