Commit bff7f5ca authored by nanahira's avatar nanahira

fix roomlist

parent a88f32ab
......@@ -20,7 +20,7 @@ init = (http_server, ROOM_all)->
connection.filter = url.parse(connection.upgradeReq.url, true).query.filter || 'waiting'
connection.send JSON.stringify
event: 'init'
data: room_data(room) for room in ROOM_all when room and room.established and (connection.filter == 'started' or !room.private) and (room.started == (connection.filter == 'started'))
data: room_data(room) for room in ROOM_all when room and room.established and (connection.filter == 'started' or !room.private) and ((room.stage != 0) == (connection.filter == 'started'))
create = (room)->
broadcast('create', room_data(room), 'waiting') if !room.private
......@@ -33,7 +33,7 @@ start = (room)->
broadcast('create', room_data(room), 'started')
_delete = (room)->
if(room.started)
if(room.stage != 0)
broadcast('delete', room.name, 'started')
else
broadcast('delete', room.name, 'waiting') if !room.private
......@@ -53,4 +53,3 @@ module.exports =
update: update
start: start
delete: _delete
......@@ -50,7 +50,7 @@
results = [];
for (i = 0, len = ROOM_all.length; i < len; i++) {
room = ROOM_all[i];
if (room && room.established && (connection.filter === 'started' || !room["private"]) && (room.started === (connection.filter === 'started'))) {
if (room && room.established && (connection.filter === 'started' || !room["private"]) && ((room.stage !== 0) === (connection.filter === 'started'))) {
results.push(room_data(room));
}
}
......@@ -80,7 +80,7 @@
};
_delete = function(room) {
if (room.started) {
if (room.stage !== 0) {
return broadcast('delete', room.name, 'started');
} else {
if (!room["private"]) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment