Node.js based forum software built for the modern web
cant fork if not logged in
Baris Soner Usakli291aa872c420
diff --git a/src/topics.js b/src/topics.jsindex 1ba193e9ba..8215d19f26 100644--- a/src/topics.js+++ b/src/topics.js@@ -198,7 +198,7 @@ var async = require('async'),});}- Topics.createTopicFromPosts = function(title, pids, callback) {+ Topics.createTopicFromPosts = function(uid, title, pids, callback) {if(title) {title = title.trim();}@@ -214,6 +214,9 @@ var async = require('async'),pids.sort();var mainPid = pids[0];+ //TODO: check if we can move all the pids, threadTools privs? -baris++posts.getPostData(mainPid, function(err, postData) {if(err) {return callback(err);diff --git a/src/websockets.js b/src/websockets.jsindex fddd4beaa3..8dad9c3c18 100644--- a/src/websockets.js+++ b/src/websockets.js@@ -623,7 +623,17 @@ websockets.init = function(io) {});socket.on('api:topic.createTopicFromPosts', function(data, callback) {- topics.createTopicFromPosts(data.title, data.pids, function(err, data) {+ if(!uid) {+ socket.emit('event:alert', {+ title: 'Can't fork',+ message: 'Guests can't fork topics!',+ type: 'warning',+ timeout: 2000+ });+ return;+ }++ topics.createTopicFromPosts(uid, data.title, data.pids, function(err, data) {callback(err?{message:err.message}:null, data);});});