mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 02:55:58 +01:00 
			
		
		
		
	move modifyPostByPrivilege call before filtering posts so index is correct
This commit is contained in:
		| @@ -159,17 +159,14 @@ SocketPosts.getReplies = function (socket, pid, callback) { | |||||||
| 		}, | 		}, | ||||||
| 		function (results, next) { | 		function (results, next) { | ||||||
| 			postPrivileges = results.privileges; | 			postPrivileges = results.privileges; | ||||||
|  | 			results.posts.forEach(function (postData, index) { | ||||||
|  | 				posts.modifyPostByPrivilege(postData, postPrivileges[index]); | ||||||
|  | 			}); | ||||||
| 			results.posts = results.posts.filter(function (postData, index) { | 			results.posts = results.posts.filter(function (postData, index) { | ||||||
| 				return postData && postPrivileges[index].read; | 				return postData && postPrivileges[index].read; | ||||||
| 			}); | 			}); | ||||||
| 			topics.addPostData(results.posts, socket.uid, next); | 			topics.addPostData(results.posts, socket.uid, next); | ||||||
| 		}, | 		}, | ||||||
| 		function (postData, next) { |  | ||||||
| 			postData.forEach(function (postData, index) { |  | ||||||
| 				posts.modifyPostByPrivilege(postData, postPrivileges[index]); |  | ||||||
| 			}); |  | ||||||
| 			next(null, postData); |  | ||||||
| 		}, |  | ||||||
| 	], callback); | 	], callback); | ||||||
| }; | }; | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user