This commit is contained in:
barisusakli
2014-08-13 21:42:04 -04:00
parent d12a526e82
commit c9c454825e
4 changed files with 61 additions and 28 deletions

View File

@@ -240,4 +240,19 @@ var winston = require('winston'),
], callback);
};
ThreadTools.follow = function(tid, uid, callback) {
callback = callback || function() {};
async.waterfall([
function (next) {
ThreadTools.exists(tid, next);
},
function (exists, next) {
if (!exists) {
return next(new Error('[[error:no-topic]]'));
}
db.setAdd('tid:' + tid + ':followers', uid, next);
}
], callback);
};
}(exports));