mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-11-03 20:45:58 +01:00 
			
		
		
		
	src/topics.js cleanup
This commit is contained in:
		@@ -31,19 +31,18 @@ module.exports = function(Topics) {
 | 
			
		||||
	Topics.getTopicPosts = function(tid, set, start, end, uid, reverse, callback) {
 | 
			
		||||
		callback = callback || function() {};
 | 
			
		||||
		posts.getPostsByTid(tid, set, start, end, uid, reverse, function(err, postData) {
 | 
			
		||||
			if(err) {
 | 
			
		||||
			if (err) {
 | 
			
		||||
				return callback(err);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			if (Array.isArray(postData) && !postData.length) {
 | 
			
		||||
				return callback(null, []);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			Topics.addPostData(postData, uid, callback);
 | 
			
		||||
		});
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
	Topics.addPostData = function(postData, uid, callback) {
 | 
			
		||||
		if (!Array.isArray(postData) || !postData.length) {
 | 
			
		||||
			return callback(null, []);
 | 
			
		||||
		}
 | 
			
		||||
		var pids = postData.map(function(post) {
 | 
			
		||||
			return post && post.pid;
 | 
			
		||||
		});
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user