mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 19:15:58 +01:00 
			
		
		
		
	#621, moved everything out of parallel - poster doesn't need to wait for these functions to happen
also renamed topics.markUnRead to topics.markAsUnreadForAll
This commit is contained in:
		
							
								
								
									
										49
									
								
								src/posts.js
									
									
									
									
									
								
							
							
						
						
									
										49
									
								
								src/posts.js
									
									
									
									
									
								
							| @@ -135,38 +135,29 @@ var db = require('./database'), | ||||
| 				} | ||||
|  | ||||
| 				Posts.getCidByPid(postData.pid, function(err, cid) { | ||||
| 					db.delete('cid:' + cid + ':read_by_uid'); | ||||
| 				}); | ||||
|  | ||||
| 				async.parallel([ | ||||
| 					function(next) { | ||||
| 						topics.markUnRead(tid, function(err) { | ||||
| 							if(err) { | ||||
| 								return next(err); | ||||
| 							} | ||||
| 							topics.markAsRead(tid, uid); | ||||
| 							next(); | ||||
| 						}); | ||||
| 					}, | ||||
| 					function(next) { | ||||
| 						topics.pushUnreadCount(null, next); | ||||
| 					}, | ||||
| 					function(next) { | ||||
| 						threadTools.notifyFollowers(tid, uid); | ||||
| 						next(); | ||||
| 					}, | ||||
| 					function(next) { | ||||
| 						Posts.addUserInfoToPost(postData, function(err) { | ||||
| 							if(err) { | ||||
| 								return next(err); | ||||
| 							} | ||||
| 							next(); | ||||
| 						}); | ||||
| 					} | ||||
| 				], function(err, results) { | ||||
| 					if(err) { | ||||
| 						return callback(err, null); | ||||
| 					} | ||||
|  | ||||
| 					db.delete('cid:' + cid + ':read_by_uid'); | ||||
| 				}); | ||||
|  | ||||
| 				topics.markAsUnreadForAll(tid, function(err) { | ||||
| 					if(err) { | ||||
| 						return callback(err, null); | ||||
| 					} | ||||
|  | ||||
| 					topics.markAsRead(tid, uid); | ||||
| 					topics.pushUnreadCount(); | ||||
| 				}); | ||||
|  | ||||
| 				threadTools.notifyFollowers(tid, uid); | ||||
| 				 | ||||
| 				Posts.addUserInfoToPost(postData, function(err) { | ||||
| 					if(err) { | ||||
| 						return callback(err, null); | ||||
| 					} | ||||
|  | ||||
| 					callback(null, postData); | ||||
| 				}); | ||||
| 			}); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user