mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-11-03 20:45:58 +01:00 
			
		
		
		
	closes #107
This commit is contained in:
		@@ -314,6 +314,32 @@ var	RDB = require('./redis.js'),
 | 
			
		||||
		});
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	Categories.moveRecentReplies = function(tid, oldCid, cid, callback) {
 | 
			
		||||
		topics.getPids(tid, function(err, pids) {
 | 
			
		||||
			if(!err) {
 | 
			
		||||
 | 
			
		||||
				function movePost(pid, callback) {
 | 
			
		||||
					posts.getPostField(pid, 'timestamp', function(timestamp) {
 | 
			
		||||
						RDB.zrem('categories:recent_posts:cid:' + oldCid, pid);	
 | 
			
		||||
						RDB.zadd('categories:recent_posts:cid:' + cid, timestamp, pid);	
 | 
			
		||||
					});
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				async.each(pids, movePost, function(err) {
 | 
			
		||||
					if(!err) {
 | 
			
		||||
						callback(null, 1)
 | 
			
		||||
					} else {
 | 
			
		||||
						console.log(err);
 | 
			
		||||
						callback(err, null);
 | 
			
		||||
					}
 | 
			
		||||
				});
 | 
			
		||||
			} else {
 | 
			
		||||
				console.log(err);
 | 
			
		||||
				callback(err, null);
 | 
			
		||||
			}
 | 
			
		||||
		});
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	Categories.getCategoryData = function(cid, callback) {
 | 
			
		||||
		RDB.hgetall('category:' + cid, function(err, data) {
 | 
			
		||||
			if(err === null)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user