mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-04 14:50:47 +01:00
closes #1439
This commit is contained in:
@@ -169,13 +169,13 @@ define(['composer', 'forum/pagination', 'share', 'navigator', 'forum/categoryToo
|
||||
}
|
||||
}
|
||||
|
||||
Category.onNewTopic = function(data) {
|
||||
$(window).trigger('filter:categories.new_topic', data.topicData);
|
||||
Category.onNewTopic = function(topic) {
|
||||
$(window).trigger('filter:categories.new_topic', topic);
|
||||
|
||||
ajaxify.loadTemplate('category', function(categoryTemplate) {
|
||||
var html = templates.parse(templates.getBlock(categoryTemplate, 'topics'), {
|
||||
privileges: data.privileges,
|
||||
topics: [data.topicData]
|
||||
privileges: {editable: !!$('.thread-tools').length},
|
||||
topics: [topic]
|
||||
});
|
||||
|
||||
translator.translate(html, function(translatedHTML) {
|
||||
|
||||
@@ -953,7 +953,12 @@ define(['taskbar'], function(taskbar) {
|
||||
content: bodyEl.val(),
|
||||
topic_thumb: thumbEl.val() || '',
|
||||
category_id: postData.cid
|
||||
}, done);
|
||||
}, function(err, topic) {
|
||||
done(err);
|
||||
if (!err) {
|
||||
ajaxify.go('topic/' + topic.slug);
|
||||
}
|
||||
});
|
||||
} else if (parseInt(postData.tid, 10) > 0) {
|
||||
socket.emit('posts.reply', {
|
||||
tid: postData.tid,
|
||||
|
||||
@@ -32,9 +32,9 @@ SocketTopics.post = function(socket, data, callback) {
|
||||
|
||||
if (result) {
|
||||
|
||||
index.server.sockets.in('category_' + data.category_id).emit('event:new_topic', result);
|
||||
index.server.sockets.in('recent_posts').emit('event:new_topic', result);
|
||||
index.server.sockets.in('home').emit('event:new_topic', result);
|
||||
index.server.sockets.in('category_' + data.category_id).emit('event:new_topic', result.topicData);
|
||||
index.server.sockets.in('recent_posts').emit('event:new_topic', result.topicData);
|
||||
index.server.sockets.in('home').emit('event:new_topic', result.topicData);
|
||||
index.server.sockets.in('home').emit('event:new_post', {
|
||||
posts: result.postData
|
||||
});
|
||||
@@ -44,7 +44,7 @@ SocketTopics.post = function(socket, data, callback) {
|
||||
|
||||
module.parent.exports.emitTopicPostStats();
|
||||
|
||||
callback();
|
||||
callback(null, result.topicData);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -82,7 +82,6 @@ module.exports = function(Topics) {
|
||||
return callback(new Error('[[error:title-too-long, ' + meta.config.maximumTitleLength + ']]'));
|
||||
}
|
||||
|
||||
var categoryPrivileges;
|
||||
async.waterfall([
|
||||
function(next) {
|
||||
categoryTools.exists(cid, next);
|
||||
@@ -94,7 +93,6 @@ module.exports = function(Topics) {
|
||||
categoryTools.privileges(cid, uid, next);
|
||||
},
|
||||
function(privileges, next) {
|
||||
categoryPrivileges = privileges;
|
||||
if(!privileges.write) {
|
||||
return next(new Error('[[error:no-privileges]]'));
|
||||
}
|
||||
@@ -125,7 +123,6 @@ module.exports = function(Topics) {
|
||||
topicData.unreplied = 1;
|
||||
|
||||
next(null, {
|
||||
privileges: categoryPrivileges,
|
||||
topicData: topicData,
|
||||
postData: postData
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user