Skip to content

Node.js based forum software built for the modern web

fixed #3007

Julian Lam87111ee6be4d
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;