fixed crash in flags page for now

v1.18.x
Julian Lam 9 years ago
parent 1aa70c57eb
commit 106502952a

@ -246,7 +246,7 @@ Flags.get = function (set, cid, uid, start, stop, callback) {
}, },
function (pids, next) { function (pids, next) {
if (cid) { if (cid) {
Posts.filterPidsByCid(pids, cid, next); posts.filterPidsByCid(pids, cid, next);
} else { } else {
process.nextTick(next, null, pids); process.nextTick(next, null, pids);
} }
@ -272,7 +272,7 @@ function getFlaggedPostsWithReasons(pids, uid, callback) {
}, next); }, next);
}, },
posts: function (next) { posts: function (next) {
Posts.getPostSummaryByPids(pids, uid, {stripTags: false, extraFields: ['flags', 'flag:assignee', 'flag:state', 'flag:notes', 'flag:history']}, next); posts.getPostSummaryByPids(pids, uid, {stripTags: false, extraFields: ['flags', 'flag:assignee', 'flag:state', 'flag:notes', 'flag:history']}, next);
} }
}, next); }, next);
}, },
@ -299,7 +299,7 @@ function getFlaggedPostsWithReasons(pids, uid, callback) {
next(null, results.posts); next(null, results.posts);
}); });
}, },
async.apply(Posts.expandFlagHistory), async.apply(Flags.expandFlagHistory),
function (posts, next) { function (posts, next) {
// Parse out flag data into its own object inside each post hash // Parse out flag data into its own object inside each post hash
async.map(posts, function (postObj, next) { async.map(posts, function (postObj, next) {
@ -355,7 +355,7 @@ Flags.update = function (uid, pid, flagObj, callback) {
var changeset = {}; var changeset = {};
var prop; var prop;
Posts.getPostData(pid, function (err, postData) { posts.getPostData(pid, function (err, postData) {
if (err) { if (err) {
return callback(err); return callback(err);
} }
@ -417,7 +417,7 @@ Flags.update = function (uid, pid, flagObj, callback) {
// Save flag data into post hash // Save flag data into post hash
if (changes.length) { if (changes.length) {
Posts.setPostFields(pid, changeset, callback); posts.setPostFields(pid, changeset, callback);
} else { } else {
setImmediate(callback); setImmediate(callback);
} }

Loading…
Cancel
Save