moving threads will refresh view for all connected clients as well

This commit is contained in:
Julian Lam
2013-05-08 15:07:01 -04:00
parent a0fa95b9f0
commit 2ca1986b40
2 changed files with 5 additions and 1 deletions

View File

@@ -179,7 +179,6 @@
commitEl.innerHTML = 'Moving <i class="icon-spin icon-refresh"></i>';
socket.once('api:topic.move', function(data) {
console.log(data);
moveThreadModal.modal('hide');
if (data.status === 'ok') {
app.alert({
@@ -286,6 +285,10 @@
}
});
socket.on('event:topic_moved', function(data) {
if (data && data.tid > 0) ajaxify.go('topic/' + data.tid);
});
function adjust_rep(value, pid, uid) {
var post_rep = jQuery('.post_rep_' + pid),
user_rep = jQuery('.user_rep_' + uid);

View File

@@ -293,6 +293,7 @@ var RDB = require('./redis.js'),
RDB.set('tid:' + tid + ':category_slug', data.categories[0].slug);
});
socket.emit('api:topic.move', { status: 'ok' });
io.sockets.in('topic_' + tid).emit('event:topic_moved', { tid: tid });
} else {
socket.emit('api:topic.move', { status: 'error' });
}