Skip to content

Node.js based forum software built for the modern web

no rooms.enter for anons check tid on topic enter

barisusaklicbedc762fdff
diff --git a/src/socket.io/meta.js b/src/socket.io/meta.js
index 2eee30bab3..498fe185c1 100644
--- a/src/socket.io/meta.js
+++ b/src/socket.io/meta.js
@@ -63,20 +63,23 @@ SocketMeta.getUsageStats = function(socket, data, callback) {
/* Rooms */
SocketMeta.rooms.enter = function(socket, data, callback) {
+ if (!socket.uid) {
+ return;
+ }
if (!data) {
return callback(new Error('[[error:invalid-data]]'));
}
if (data.leave) {
socket.leave(data.leave);
- if (socket.uid && data.leave.indexOf('topic') !== -1) {
+ if (data.leave.indexOf('topic') !== -1) {
websockets.in(data.leave).emit('event:user_leave', socket.uid);
}
}
if (data.enter) {
socket.join(data.enter);
- if (socket.uid && data.enter.indexOf('topic') !== -1) {
+ if (data.enter.indexOf('topic') !== -1) {
data.uid = socket.uid;
websockets.in(data.enter).emit('event:user_enter', data);
}
diff --git a/src/socket.io/topics.js b/src/socket.io/topics.js
index 045ad7a135..0c367c5d91 100644
--- a/src/socket.io/topics.js
+++ b/src/socket.io/topics.js
@@ -65,7 +65,7 @@ SocketTopics.post = function(socket, data, callback) {
};
SocketTopics.enter = function(socket, tid, callback) {
- if (!tid || !socket.uid) {
+ if (!parseInt(tid, 10) || !socket.uid) {
return;
}