mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 11:05:54 +01:00 
			
		
		
		
	fix: on new post add it to cid::uid::pids
This commit is contained in:
		| @@ -64,6 +64,10 @@ module.exports = function (Posts) { | |||||||
| 				db.setObject('post:' + postData.pid, postData, next); | 				db.setObject('post:' + postData.pid, postData, next); | ||||||
| 			}, | 			}, | ||||||
| 			function (next) { | 			function (next) { | ||||||
|  | 				topics.getTopicFields(tid, ['cid', 'pinned'], next); | ||||||
|  | 			}, | ||||||
|  | 			function (topicData, next) { | ||||||
|  | 				postData.cid = topicData.cid; | ||||||
| 				async.parallel([ | 				async.parallel([ | ||||||
| 					function (next) { | 					function (next) { | ||||||
| 						user.onNewPostMade(postData, next); | 						user.onNewPostMade(postData, next); | ||||||
| @@ -72,13 +76,7 @@ module.exports = function (Posts) { | |||||||
| 						topics.onNewPostMade(postData, next); | 						topics.onNewPostMade(postData, next); | ||||||
| 					}, | 					}, | ||||||
| 					function (next) { | 					function (next) { | ||||||
| 						topics.getTopicFields(tid, ['cid', 'pinned'], function (err, topicData) { |  | ||||||
| 							if (err) { |  | ||||||
| 								return next(err); |  | ||||||
| 							} |  | ||||||
| 							postData.cid = topicData.cid; |  | ||||||
| 						categories.onNewPostMade(topicData.cid, topicData.pinned, postData, next); | 						categories.onNewPostMade(topicData.cid, topicData.pinned, postData, next); | ||||||
| 						}); |  | ||||||
| 					}, | 					}, | ||||||
| 					function (next) { | 					function (next) { | ||||||
| 						groups.onNewPostMade(postData, next); | 						groups.onNewPostMade(postData, next); | ||||||
|   | |||||||
| @@ -69,7 +69,7 @@ module.exports = function (User) { | |||||||
| 	User.onNewPostMade = function (postData, callback) { | 	User.onNewPostMade = function (postData, callback) { | ||||||
| 		async.series([ | 		async.series([ | ||||||
| 			function (next) { | 			function (next) { | ||||||
| 				User.addPostIdToUser(postData.uid, postData.pid, postData.timestamp, next); | 				User.addPostIdToUser(postData, next); | ||||||
| 			}, | 			}, | ||||||
| 			function (next) { | 			function (next) { | ||||||
| 				User.incrementUserPostCountBy(postData.uid, 1, next); | 				User.incrementUserPostCountBy(postData.uid, 1, next); | ||||||
| @@ -83,8 +83,11 @@ module.exports = function (User) { | |||||||
| 		], callback); | 		], callback); | ||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
| 	User.addPostIdToUser = function (uid, pid, timestamp, callback) { | 	User.addPostIdToUser = function (postData, callback) { | ||||||
| 		db.sortedSetAdd('uid:' + uid + ':posts', timestamp, pid, callback); | 		db.sortedSetsAdd([ | ||||||
|  | 			'uid:' + postData.uid + ':posts', | ||||||
|  | 			'cid:' + postData.cid + ':uid:' + postData.uid + ':pids', | ||||||
|  | 		], postData.timestamp, postData.pid, callback); | ||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
| 	User.incrementUserPostCountBy = function (uid, value, callback) { | 	User.incrementUserPostCountBy = function (uid, value, callback) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user