'use strict'; var async = require('async'), validator = require('validator'), S = require('string'), db = require('../database'), user = require('../user'), plugins = require('../plugins'), categories = require('../categories'), postTools = require('../postTools'), utils = require('../../public/src/utils'); module.exports = function(Posts) { Posts.getPostSummaryByPids = function(pids, uid, options, callback) { if (!Array.isArray(pids) || !pids.length) { return callback(null, []); } options.stripTags = options.hasOwnProperty('stripTags') ? options.stripTags : false; options.parse = options.hasOwnProperty('parse') ? options.parse : true; options.extraFields = options.hasOwnProperty('extraFields') ? options.extraFields : []; var fields = ['pid', 'tid', 'content', 'uid', 'timestamp', 'deleted'].concat(options.extraFields); Posts.getPostsFields(pids, fields, function(err, posts) { if (err) { return callback(err); } posts = posts.filter(function(p) { return !!p && parseInt(p.deleted, 10) !== 1; }); var uids = [], topicKeys = []; for(var i=0; i