Skip to content

Commit

Permalink
Fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
ggazzo committed Jun 24, 2020
1 parent 3a1078d commit 51f48d4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
28 changes: 16 additions & 12 deletions app/ui-utils/client/lib/openRoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function replaceCenterDomBy(dom) {
return resolve([mainNode, roomNode]);
}
resolve(mainNode);
}, 1);
}, 0);
});
}

Expand All @@ -70,6 +70,17 @@ export const openRoom = async function(type, name) {
const room = roomTypes.findRoom(type, name, user) || await callMethod('getRoomByTypeAndName', type, name);
Rooms.upsert({ _id: room._id }, _.omit(room, '_id'));


if (room._id !== name && type === 'd') { // Redirect old url using username to rid
RoomManager.close(type + name);
return FlowRouter.go('direct', { rid: room._id }, FlowRouter.current().queryParams);
}


if (room._id === Session.get('openedRoom')) {
return;
}

if (RoomManager.open(type + name).ready() !== true) {
if (settings.get('Accounts_AllowAnonymousRead')) {
BlazeLayout.render('main');
Expand All @@ -78,22 +89,15 @@ export const openRoom = async function(type, name) {
return;
}

BlazeLayout.render('main', {
center: 'loading',
});

c.stop();

if (window.currentTracker) {
window.currentTracker = undefined;
}

if (room._id !== name && type === 'd') { // Redirect old url using username to rid
RoomManager.close(type + name);
return FlowRouter.go('direct', { rid: room._id }, FlowRouter.current().queryParams);
}


if (room._id === Session.get('openedRoom')) {
return;
}

const [mainNode, roomDom] = await replaceCenterDomBy(() => RoomManager.getDomOfRoom(type + name, room._id, roomTypes.getConfig(type).mainTemplate));

if (mainNode) {
Expand Down
5 changes: 1 addition & 4 deletions app/utils/lib/roomExit.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ export const roomExit = function() {
}
}
callbacks.run('roomExit');
BlazeLayout.render('main', {
center: 'none',
});

Session.set('openedRoom', null);
RoomManager.openedRoom = null;
Expand All @@ -52,8 +49,8 @@ export const roomExit = function() {
child.oldScrollTop = wrapper.scrollTop;
}
}
mainNode.removeChild(child);
}
mainNode.removeChild(child);
});
});
};

0 comments on commit 51f48d4

Please sign in to comment.