mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 02:55:58 +01:00 
			
		
		
		
	footer shows total topic post count
This commit is contained in:
		
							
								
								
									
										19
									
								
								src/posts.js
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								src/posts.js
									
									
									
									
									
								
							| @@ -201,6 +201,8 @@ marked.setOptions({ | ||||
| 						timeout: 2000 | ||||
| 					}); | ||||
|  | ||||
| 					Posts.getTopicPostStats(socket); | ||||
|  | ||||
| 					// Send notifications to users who are following this topic | ||||
| 					threadTools.notify_followers(tid, uid); | ||||
|  | ||||
| @@ -265,6 +267,8 @@ marked.setOptions({ | ||||
| 					RDB.zadd(schema.topics().recent, timestamp, tid); | ||||
| 					RDB.set('tid:' + tid + ':lastposttime', timestamp); | ||||
|  | ||||
| 					RDB.incr('totalpostcount'); | ||||
|  | ||||
| 					user.getUserFields(uid, ['username'], function(data) { // todo parallel | ||||
| 						//add active users to this category | ||||
| 						RDB.get('tid:' + tid + ':cid', function(err, cid) { | ||||
| @@ -339,4 +343,19 @@ marked.setOptions({ | ||||
| 		});				 | ||||
| 	} | ||||
|  | ||||
| 	Posts.getTopicPostStats = function(socket) { | ||||
| 		RDB.mget(['totaltopiccount', 'totalpostcount'], function(err, data) { | ||||
| 			if(err === null) { | ||||
| 				var stats = { | ||||
| 					topics: data[1]?data[1]:0, | ||||
| 					posts: data[0]?data[0]:0				 | ||||
| 				}; | ||||
| 				 | ||||
| 				socket.emit('post.stats', stats); | ||||
| 			}				 | ||||
| 			else | ||||
| 				console.log(err); | ||||
| 		}); | ||||
| 	} | ||||
|  | ||||
| }(exports)); | ||||
		Reference in New Issue
	
	Block a user