"use strict"; var async = require('async'), validator = require('validator'), _ = require('underscore'), db = require('./database'), posts = require('./posts'), utils = require('../public/src/utils'), plugins = require('./plugins'), user = require('./user'), categories = require('./categories'), privileges = require('./privileges'); (function(Topics) { require('./topics/create')(Topics); require('./topics/delete')(Topics); require('./topics/unread')(Topics); require('./topics/recent')(Topics); require('./topics/popular')(Topics); require('./topics/user')(Topics); require('./topics/fork')(Topics); require('./topics/posts')(Topics); require('./topics/follow')(Topics); require('./topics/tags')(Topics); require('./topics/teaser')(Topics); require('./topics/suggested')(Topics); Topics.exists = function(tid, callback) { db.isSortedSetMember('topics:tid', tid, callback); }; Topics.getTopicData = function(tid, callback) { db.getObject('topic:' + tid, function(err, topic) { if (err || !topic) { return callback(err); } modifyTopic(topic, callback); }); }; Topics.getTopicsData = function(tids, callback) { var keys = []; for (var i=0; i