This commit is contained in:
barisusakli
2016-04-19 20:04:32 +03:00
parent d83a1987eb
commit ff88186d41
6 changed files with 115 additions and 61 deletions

View File

@@ -2,10 +2,9 @@
'use strict';
var async = require('async'),
db = require('../database'),
posts = require('../posts');
var async = require('async');
var db = require('../database');
var posts = require('../posts');
module.exports = function(Topics) {
@@ -20,22 +19,6 @@ module.exports = function(Topics) {
};
Topics.getUids = function(tid, callback) {
async.waterfall([
function(next) {
Topics.getPids(tid, next);
},
function(pids, next) {
posts.getPostsFields(pids, ['uid'], next);
},
function(postData, next) {
var uids = postData.map(function(post) {
return post && post.uid;
}).filter(function(uid, index, array) {
return uid && array.indexOf(uid) === index;
});
next(null, uids);
}
], callback);
db.getSortedSetRevRangeByScore('tid:' + tid + ':posters', 0, -1, '+inf', 1, callback);
};
};