Skip to content
Snippets Groups Projects
Unverified Commit 3403d8b3 authored by Rodrigo Nascimento's avatar Rodrigo Nascimento
Browse files

Merge pull request #8314 from szluohua/synchronizing

[FIX] After deleting the room, cache is not synchronizing
parent 63b910ed
No related branches found
No related tags found
No related merge requests found
......@@ -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'));
......
......@@ -954,4 +954,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}));
......
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