Node.js based forum software built for the modern web
fixed topics bug that was prevent /latest /popular /active and subsequently the admin versions of those routes from working. removed debug statements. added admin socket room. added dynamic updating of active users on acp index
psychobunny09c9d0ee1f65
diff --git a/public/src/app.js b/public/src/app.jsindex 88b2b51f24..bde0fc4e71 100644--- a/public/src/app.js+++ b/public/src/app.js@@ -182,6 +182,7 @@ var socket,app.current_room = null;app.enter_room = function(room) {+ console.log(room)if (app.current_room === room) return;socket.emit('event:enter_room', {diff --git a/public/templates/admin/footer.tpl b/public/templates/admin/footer.tplindex 7fdd8d9af2..f5fc244c4b 100644--- a/public/templates/admin/footer.tpl+++ b/public/templates/admin/footer.tpl@@ -24,6 +24,7 @@}, false);});+}())</script>diff --git a/public/templates/admin/index.tpl b/public/templates/admin/index.tplindex 8140753570..ab022f15b7 100644--- a/public/templates/admin/index.tpl+++ b/public/templates/admin/index.tpl@@ -26,17 +26,19 @@socket.on('api:get_all_rooms', function(data) {var active_users = document.getElementById('active_users'),total = 0;-+ active_users.innerHTML = '';+for(var room in data) {if (room !== '') {var count = data[room].length;total += count;- active_users.innerHTML = active_users.innerHTML + "<div class='alert alert-success'><strong>" + room + "</strong> " + count + " active user" + (count > 1 ? "s" : "") + "</div><br />";+ active_users.innerHTML = active_users.innerHTML + "<div class='alert alert-success'><strong>" + room + "</strong> " + count + " active user" + (count > 1 ? "s" : "") + "</div>";}}document.getElementById('connections').innerHTML = total;});+ app.enter_room('admin');socket.emit('api:get_all_rooms');</script>\ No newline at end of filediff --git a/src/topics.js b/src/topics.jsindex 4280e09882..bd02ac8405 100644--- a/src/topics.js+++ b/src/topics.js@@ -140,7 +140,7 @@ var RDB = require('./redis.js'),// Global Topicsif (uid == null) uid = 0;if (uid !== null) {- RDB.lpush('topics:tid', tid);+ RDB.db.sadd('topics:tid', tid);} else {// need to add some unique key sent by client so we can update this with the real uid laterRDB.lpush('topics:queued:tid', tid);diff --git a/src/websockets.js b/src/websockets.jsindex 928c02a75a..ca843ab3f0 100644--- a/src/websockets.js+++ b/src/websockets.js@@ -66,7 +66,6 @@ var SocketIO = require('socket.io').listen(global.server,{log:false}),});socket.on('api:get_all_rooms', function(data) {- console.log('recieve');socket.emit('api:get_all_rooms', io.sockets.manager.rooms);})@@ -101,6 +100,8 @@ var SocketIO = require('socket.io').listen(global.server,{log:false}),anonymous: anonymous});});++ if (data.enter != 'admin') io.sockets.in('admin').emit('api:get_all_rooms', io.sockets.manager.rooms);});