From 87111ee6be4d785173ed8ba15ffd1748a64fd790 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Fri, 24 Jul 2015 10:22:21 -0400 Subject: [PATCH] fixed #3007 --- src/posts/summary.js | 5 +++++ src/topics/teaser.js | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/posts/summary.js b/src/posts/summary.js index b41519473a..582354499d 100644 --- a/src/posts/summary.js +++ b/src/posts/summary.js @@ -72,6 +72,11 @@ module.exports = function(Posts) { }); async.map(posts, function(post, next) { + // If the post author isn't represented in the retrieved users' data, then it means they were deleted, assume guest. + if (!results.users.hasOwnProperty(post.uid)) { + post.uid = 0; + } + post.user = results.users[post.uid]; post.topic = results.topics[post.tid]; post.category = results.categories[post.topic.cid]; diff --git a/src/topics/teaser.js b/src/topics/teaser.js index 4558fb251a..29e05703d2 100644 --- a/src/topics/teaser.js +++ b/src/topics/teaser.js @@ -57,6 +57,11 @@ module.exports = function(Topics) { var tidToPost = {}; async.each(postData, function(post, next) { + // If the post author isn't represented in the retrieved users' data, then it means they were deleted, assume guest. + if (!users.hasOwnProperty(post.uid)) { + post.uid = 0; + } + post.user = users[post.uid]; post.timestamp = utils.toISOString(post.timestamp); tidToPost[post.tid] = post;