From 0f3e8acde2ab3783d6e4eccba2c6e6b62f86e1a8 Mon Sep 17 00:00:00 2001 From: Rob DiMarco Date: Fri, 1 Nov 2013 15:25:33 -0700 Subject: [PATCH] Fixes #4 - Entering / exiting room lists with unauthenticated --- src/js/firechat.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/js/firechat.js b/src/js/firechat.js index 279924f..3f5b67e 100644 --- a/src/js/firechat.js +++ b/src/js/firechat.js @@ -363,13 +363,14 @@ // Leave a chat room. Firechat.prototype.leaveRoom = function(roomId) { var self = this, - userRoomRef = self._firebase.child('room-users').child(roomId), - presenceRef = userRoomRef.child(self._userId).child(self._sessionId); + userRoomRef = self._firebase.child('room-users').child(roomId); // Remove listener for new messages to this room. self._messageRef.child(roomId).off(); if (self._user) { + var presenceRef = userRoomRef.child(self._userId).child(self._sessionId); + // Remove presence bit for the room and cancel on-disconnect removal. self._removePresenceOperation(presenceRef.toString(), null);