fixing socket returns to emit to everybody in the room (on thread locking/deletion)

v1.18.x
Julian Lam 12 years ago
parent 7ed2413d96
commit 43a76f9c9c

@ -138,7 +138,6 @@
}); });
socket.on('event:topic_deleted', function(data) { socket.on('event:topic_deleted', function(data) {
console.log('deleted');
if (data.tid === tid && data.status === 'ok') { if (data.tid === tid && data.status === 'ok') {
set_locked_state(true); set_locked_state(true);
set_delete_state(true); set_delete_state(true);
@ -146,7 +145,6 @@
}); });
socket.on('event:topic_restored', function(data) { socket.on('event:topic_restored', function(data) {
console.log('restored');
if (data.tid === tid && data.status === 'ok') { if (data.tid === tid && data.status === 'ok') {
set_locked_state(false); set_locked_state(false);
set_delete_state(false); set_delete_state(false);
@ -154,14 +152,12 @@
}); });
socket.on('event:topic_locked', function(data) { socket.on('event:topic_locked', function(data) {
console.log('locked');
if (data.tid === tid && data.status === 'ok') { if (data.tid === tid && data.status === 'ok') {
set_locked_state(true); set_locked_state(true);
} }
}); });
socket.on('event:topic_unlocked', function(data) { socket.on('event:topic_unlocked', function(data) {
console.log('unlocked');
if (data.tid === tid && data.status === 'ok') { if (data.tid === tid && data.status === 'ok') {
set_locked_state(false); set_locked_state(false);
} }

@ -149,7 +149,7 @@ var RDB = require('./redis.js'),
RDB.set('tid:' + tid + ':locked', 1); RDB.set('tid:' + tid + ':locked', 1);
if (socket) { if (socket) {
socket.in('topic_' + tid).emit('event:topic_locked', { io.sockets.in('topic_' + tid).emit('event:topic_locked', {
tid: tid, tid: tid,
status: 'ok' status: 'ok'
}); });
@ -165,7 +165,7 @@ var RDB = require('./redis.js'),
RDB.del('tid:' + tid + ':locked'); RDB.del('tid:' + tid + ':locked');
if (socket) { if (socket) {
socket.in('topic_' + tid).emit('event:topic_unlocked', { io.sockets.in('topic_' + tid).emit('event:topic_unlocked', {
tid: tid, tid: tid,
status: 'ok' status: 'ok'
}); });
@ -182,7 +182,7 @@ var RDB = require('./redis.js'),
Topics.lock(tid, uid); Topics.lock(tid, uid);
if (socket) { if (socket) {
socket.in('topic_' + tid).emit('event:topic_deleted', { io.sockets.in('topic_' + tid).emit('event:topic_deleted', {
tid: tid, tid: tid,
status: 'ok' status: 'ok'
}); });
@ -199,7 +199,7 @@ var RDB = require('./redis.js'),
Topics.unlock(tid, uid); Topics.unlock(tid, uid);
if (socket) { if (socket) {
socket.in('topic_' + tid).emit('event:topic_restored', { io.sockets.in('topic_' + tid).emit('event:topic_restored', {
tid: tid, tid: tid,
status: 'ok' status: 'ok'
}); });

Loading…
Cancel
Save