mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-29 10:06:13 +01:00
closes #1436
This commit is contained in:
@@ -170,10 +170,13 @@ define(['composer', 'forum/pagination', 'share', 'navigator', 'forum/categoryToo
|
||||
}
|
||||
|
||||
Category.onNewTopic = function(data) {
|
||||
$(window).trigger('filter:categories.new_topic', data);
|
||||
$(window).trigger('filter:categories.new_topic', data.topicData);
|
||||
|
||||
ajaxify.loadTemplate('category', function(categoryTemplate) {
|
||||
var html = templates.parse(templates.getBlock(categoryTemplate, 'topics'), {topics: [data]});
|
||||
var html = templates.parse(templates.getBlock(categoryTemplate, 'topics'), {
|
||||
privileges: data.privileges,
|
||||
topics: [data.topicData]
|
||||
});
|
||||
|
||||
translator.translate(html, function(translatedHTML) {
|
||||
var topic = $(translatedHTML),
|
||||
|
||||
@@ -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.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('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('home').emit('event:new_post', {
|
||||
posts: result.postData
|
||||
});
|
||||
|
||||
@@ -82,6 +82,7 @@ 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);
|
||||
@@ -93,6 +94,7 @@ module.exports = function(Topics) {
|
||||
categoryTools.privileges(cid, uid, next);
|
||||
},
|
||||
function(privileges, next) {
|
||||
categoryPrivileges = privileges;
|
||||
if(!privileges.write) {
|
||||
return next(new Error('[[error:no-privileges]]'));
|
||||
}
|
||||
@@ -123,6 +125,7 @@ module.exports = function(Topics) {
|
||||
topicData.unreplied = 1;
|
||||
|
||||
next(null, {
|
||||
privileges: categoryPrivileges,
|
||||
topicData: topicData,
|
||||
postData: postData
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user