cant fork if not logged in

v1.18.x
Baris Soner Usakli 11 years ago
parent 2e575bb2d8
commit 291aa872c4

@ -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);

@ -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);
});
});

Loading…
Cancel
Save