Skip to content

Node.js based forum software built for the modern web

closes #5613

Barış Soner Uşaklı6fb90a17e061
diff --git a/public/src/app.js b/public/src/app.js
index 1c20346a7a..61e5deac50 100644
--- a/public/src/app.js
+++ b/public/src/app.js
@@ -191,11 +191,13 @@ app.cacheBuster = null;
if (!socket) {
return;
}
+ var previousRoom = app.currentRoom;
+ app.currentRoom = '';
socket.emit('meta.rooms.leaveCurrent', function (err) {
if (err) {
+ app.currentRoom = previousRoom;
return app.alertError(err.message);
}
- app.currentRoom = '';
});
};
diff --git a/public/src/client/topic/postTools.js b/public/src/client/topic/postTools.js
index 90de1cf810..8bbda4d79c 100644
--- a/public/src/client/topic/postTools.js
+++ b/public/src/client/topic/postTools.js
@@ -295,7 +295,7 @@ define('forum/topic/postTools', [
socket.emit(method, {
pid: pid,
- room_id: app.currentRoom,
+ room_id: 'topic_' + ajaxify.data.tid,
}, function (err) {
if (err) {
app.alertError(err.message);
diff --git a/public/src/client/topic/votes.js b/public/src/client/topic/votes.js
index d152d9f4a0..99ca469fe3 100644
--- a/public/src/client/topic/votes.js
+++ b/public/src/client/topic/votes.js
@@ -67,7 +67,7 @@ define('forum/topic/votes', ['components', 'translator'], function (components,
socket.emit(currentState ? 'posts.unvote' : method, {
pid: post.attr('data-pid'),
- room_id: app.currentRoom,
+ room_id: 'topic_' + ajaxify.data.tid,
}, function (err) {
if (err) {
if (err.message === 'self-vote') {
diff --git a/src/socket.io/posts/helpers.js b/src/socket.io/posts/helpers.js
index c7b92488d5..a9bb9b451d 100644
--- a/src/socket.io/posts/helpers.js
+++ b/src/socket.io/posts/helpers.js
@@ -14,10 +14,14 @@ helpers.postCommand = function (socket, command, eventName, notification, data,
return callback(new Error('[[error:not-logged-in]]'));
}
- if (!data || !data.pid || !data.room_id) {
+ if (!data || !data.pid) {
return callback(new Error('[[error:invalid-data]]'));
}
+ if (!data.room_id) {
+ return callback(new Error('[[error:invalid-room-id, ' + data.room_id + ' ]]'));
+ }
+
async.waterfall([
function (next) {
async.parallel({