diff --git a/app/sagas/rooms.js b/app/sagas/rooms.js index 28cb12fc..4787c271 100644 --- a/app/sagas/rooms.js +++ b/app/sagas/rooms.js @@ -51,9 +51,9 @@ const handleRoomsRequest = function* handleRoomsRequest({ params }) { const subCollection = db.get('subscriptions'); const messagesCollection = db.get('messages'); - const subsIds = subscriptions.map(sub => sub.rid).concat(roomsResult.remove.map(room => room._id)); + const subsIds = subscriptions.map(sub => sub._id).concat(subscriptionsResult.remove.map(sub => sub._id)); if (subsIds.length) { - const existingSubs = yield subCollection.query(Q.where('id', Q.oneOf(subsIds))).fetch(); + const existingSubs = yield subCollection.query(Q.where('_id', Q.oneOf(subsIds))).fetch(); const subsToUpdate = existingSubs.filter(i1 => subscriptions.find(i2 => i1._id === i2._id)); const subsToCreate = subscriptions.filter(i1 => !existingSubs.find(i2 => i1._id === i2._id)); const subsToDelete = existingSubs.filter(i1 => !subscriptions.find(i2 => i1._id === i2._id));