mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 19:15:58 +01:00 
			
		
		
		
	configurable post delay before first post
This commit is contained in:
		
							
								
								
									
										13
									
								
								src/user.js
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								src/user.js
									
									
									
									
									
								
							| @@ -151,7 +151,7 @@ var | ||||
|  | ||||
| 		async.parallel({ | ||||
| 			userData: function(next) { | ||||
| 				User.getUserFields(uid, ['banned', 'lastposttime', 'email', 'email:confirmed'], next); | ||||
| 				User.getUserFields(uid, ['banned', 'lastposttime', 'joindate', 'email', 'email:confirmed'], next); | ||||
| 			}, | ||||
| 			exists: function(next) { | ||||
| 				db.exists('user:' + uid, next); | ||||
| @@ -181,13 +181,14 @@ var | ||||
| 			if (userData.email && parseInt(meta.config.requireEmailConfirmation, 10) === 1 && parseInt(userData['email:confirmed'], 10) !== 1) { | ||||
| 				return callback(new Error('[[error:email-not-confirmed]]')); | ||||
| 			} | ||||
|  | ||||
| 			var lastposttime = userData.lastposttime; | ||||
| 			if (!lastposttime) { | ||||
| 				lastposttime = 0; | ||||
| 			var now = Date.now(); | ||||
| 			if (now - parseInt(userData.joindate, 10) < parseInt(meta.config.initialPostDelay, 10) * 1000) { | ||||
| 				return callback(new Error('[[error:user-too-new, ' + meta.config.initialPostDelay + ']]')); | ||||
| 			} | ||||
|  | ||||
| 			if (Date.now() - parseInt(lastposttime, 10) < parseInt(meta.config.postDelay, 10) * 1000) { | ||||
| 			var lastposttime = userData.lastposttime || 0; | ||||
|  | ||||
| 			if (now - parseInt(lastposttime, 10) < parseInt(meta.config.postDelay, 10) * 1000) { | ||||
| 				return callback(new Error('[[error:too-many-posts, ' + meta.config.postDelay + ']]')); | ||||
| 			} | ||||
| 			callback(); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user