From dd2605bae7bbb54fb00f88ad37580787e5502034 Mon Sep 17 00:00:00 2001 From: Konrad Borowski Date: Mon, 21 Mar 2016 08:49:49 +0100 Subject: [PATCH] FIX: Allow displaying posts by deleted users. --- .../javascripts/discourse/lib/transform-post.js.es6 | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/discourse/lib/transform-post.js.es6 b/app/assets/javascripts/discourse/lib/transform-post.js.es6 index f1fb42c19..5c5961cbf 100644 --- a/app/assets/javascripts/discourse/lib/transform-post.js.es6 +++ b/app/assets/javascripts/discourse/lib/transform-post.js.es6 @@ -85,9 +85,11 @@ export default function transformPost(currentUser, site, post, prevPost, nextPos const postAtts = transformBasicPost(post); + const createdBy = details.created_by || {}; + postAtts.topicId = topic.id; - postAtts.topicOwner = details.created_by.id === post.user_id; - postAtts.topicCreatedById = details.created_by.id; + postAtts.topicOwner = createdBy.id === post.user_id; + postAtts.topicCreatedById = createdBy.id; postAtts.post_type = postType; postAtts.via_email = post.via_email; postAtts.isModeratorAction = postType === postTypes.moderator_action; @@ -120,8 +122,8 @@ export default function transformPost(currentUser, site, post, prevPost, nextPos if (showTopicMap) { postAtts.showTopicMap = true; postAtts.topicCreatedAt = topic.created_at; - postAtts.createdByUsername = details.created_by.username; - postAtts.createdByAvatarTemplate = details.created_by.avatar_template; + postAtts.createdByUsername = createdBy.username; + postAtts.createdByAvatarTemplate = createdBy.avatar_template; postAtts.lastPostUrl = topic.get('lastPostUrl'); postAtts.lastPostUsername = details.last_poster.username;