[FIX] After deleting the room, cache is not synchronizing

pull/8314/head
luohua 8 years ago
parent 8ab0c69213
commit 1b13e0c205
  1. 1
      packages/rocketchat-lib/client/lib/cachedCollection.js
  2. 6
      packages/rocketchat-ui/client/views/app/room.js
  3. 2
      server/publications/room.js

@ -330,6 +330,7 @@ class CachedCollection {
this.log('record received', t, record);
if (t === 'removed') {
this.collection.remove(record._id);
RoomManager.close(record.t+record.name);
} else {
delete record.$loki;
this.collection.upsert({ _id: record._id }, _.omit(record, '_id'));

@ -952,4 +952,10 @@ Template.room.onRendered(function() {
newMessage.classList.remove('not');
}
});
Tracker.autorun(function() {
const subRoom = ChatSubscription.findOne({rid:template.data._id});
if (!subRoom) {
FlowRouter.go('home');
}
});
});

@ -97,7 +97,7 @@ RocketChat.models.Rooms.cache.on('sync', (type, room/*, diff*/) => {
});
RocketChat.models.Subscriptions.on('changed', (type, subscription/*, diff*/) => {
if (type === 'inserted') {
if (type === 'inserted' || type === 'removed') {
const room = RocketChat.models.Rooms.findOneById(subscription.rid);
if (room) {
RocketChat.Notifications.notifyUserInThisInstance(subscription.u._id, 'rooms-changed', type, roomMap({_room: room}));

Loading…
Cancel
Save