Skip to content

Node.js based forum software built for the modern web

moving threads will refresh view for all connected clients as well

Julian Lam2ca1986b409f
diff --git a/public/templates/topic.tpl b/public/templates/topic.tpl
index 5f2f326fb8..b2dbc3a28b 100644
--- a/public/templates/topic.tpl
+++ b/public/templates/topic.tpl
@@ -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);
diff --git a/src/topics.js b/src/topics.js
index 06519cce40..4280e09882 100644
--- a/src/topics.js
+++ b/src/topics.js
@@ -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' });
}