mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 02:55:58 +01:00 
			
		
		
		
	closes #976
This commit is contained in:
		
							
								
								
									
										13
									
								
								src/user.js
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								src/user.js
									
									
									
									
									
								
							| @@ -15,6 +15,7 @@ var bcrypt = require('bcryptjs'), | ||||
| 	groups = require('./groups'), | ||||
| 	topics = require('./topics'), | ||||
| 	events = require('./events'), | ||||
| 	emitter = require('./emitter'), | ||||
| 	Emailer = require('./emailer'); | ||||
|  | ||||
| (function(User) { | ||||
| @@ -339,16 +340,18 @@ var bcrypt = require('bcryptjs'), | ||||
| 		}); | ||||
| 	}; | ||||
|  | ||||
| 	User.onNewPostMade = function(uid, tid, pid, timestamp) { | ||||
| 		User.addPostIdToUser(uid, pid, timestamp); | ||||
| 	User.onNewPostMade = function(postData) { | ||||
| 		User.addPostIdToUser(postData.uid, postData.pid, postData.timestamp); | ||||
|  | ||||
| 		User.incrementUserFieldBy(uid, 'postcount', 1, function(err, newpostcount) { | ||||
| 			db.sortedSetAdd('users:postcount', newpostcount, uid); | ||||
| 		User.incrementUserFieldBy(postData.uid, 'postcount', 1, function(err, newpostcount) { | ||||
| 			db.sortedSetAdd('users:postcount', newpostcount, postData.uid); | ||||
| 		}); | ||||
|  | ||||
| 		User.setUserField(uid, 'lastposttime', timestamp); | ||||
| 		User.setUserField(postData.uid, 'lastposttime', postData.timestamp); | ||||
| 	}; | ||||
|  | ||||
| 	emitter.on('newpost', User.onNewPostMade); | ||||
|  | ||||
| 	User.addPostIdToUser = function(uid, pid, timestamp) { | ||||
| 		db.sortedSetAdd('uid:' + uid + ':posts', timestamp, pid); | ||||
| 	}; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user