mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 11:05:54 +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) { | 	Category.onNewTopic = function(data) { | ||||||
| 		$(window).trigger('filter:categories.new_topic', data); | 		$(window).trigger('filter:categories.new_topic', data.topicData); | ||||||
|  |  | ||||||
| 		ajaxify.loadTemplate('category', function(categoryTemplate) { | 		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) { | 			translator.translate(html, function(translatedHTML) { | ||||||
| 				var topic = $(translatedHTML), | 				var topic = $(translatedHTML), | ||||||
|   | |||||||
| @@ -32,9 +32,9 @@ SocketTopics.post = function(socket, data, callback) { | |||||||
|  |  | ||||||
| 		if (result) { | 		if (result) { | ||||||
|  |  | ||||||
| 			index.server.sockets.in('category_' + data.category_id).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.topicData); | 			index.server.sockets.in('recent_posts').emit('event:new_topic', result); | ||||||
| 			index.server.sockets.in('home').emit('event:new_topic', result.topicData); | 			index.server.sockets.in('home').emit('event:new_topic', result); | ||||||
| 			index.server.sockets.in('home').emit('event:new_post', { | 			index.server.sockets.in('home').emit('event:new_post', { | ||||||
| 				posts: result.postData | 				posts: result.postData | ||||||
| 			}); | 			}); | ||||||
|   | |||||||
| @@ -82,6 +82,7 @@ module.exports = function(Topics) { | |||||||
| 			return callback(new Error('[[error:title-too-long, ' + meta.config.maximumTitleLength + ']]')); | 			return callback(new Error('[[error:title-too-long, ' + meta.config.maximumTitleLength + ']]')); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
|  | 		var categoryPrivileges; | ||||||
| 		async.waterfall([ | 		async.waterfall([ | ||||||
| 			function(next) { | 			function(next) { | ||||||
| 				categoryTools.exists(cid, next); | 				categoryTools.exists(cid, next); | ||||||
| @@ -93,6 +94,7 @@ module.exports = function(Topics) { | |||||||
| 				categoryTools.privileges(cid, uid, next); | 				categoryTools.privileges(cid, uid, next); | ||||||
| 			}, | 			}, | ||||||
| 			function(privileges, next) { | 			function(privileges, next) { | ||||||
|  | 				categoryPrivileges = privileges; | ||||||
| 				if(!privileges.write) { | 				if(!privileges.write) { | ||||||
| 					return next(new Error('[[error:no-privileges]]')); | 					return next(new Error('[[error:no-privileges]]')); | ||||||
| 				} | 				} | ||||||
| @@ -123,6 +125,7 @@ module.exports = function(Topics) { | |||||||
| 					topicData.unreplied = 1; | 					topicData.unreplied = 1; | ||||||
|  |  | ||||||
| 					next(null, { | 					next(null, { | ||||||
|  | 						privileges: categoryPrivileges, | ||||||
| 						topicData: topicData, | 						topicData: topicData, | ||||||
| 						postData: postData | 						postData: postData | ||||||
| 					}); | 					}); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user