mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-17 18:10:42 +01:00
cant fork if not logged in
This commit is contained in:
@@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user