FIX: Check if last poster exists before using it

There was a problem when admins viewed topics where the last poster was
deleted.
This commit is contained in:
Bianca Nenciu 2020-07-13 18:51:43 +03:00
parent c8856c7a43
commit 6c6c56613d
1 changed files with 5 additions and 3 deletions

View File

@ -172,9 +172,11 @@ export default function transformPost(
postAtts.createdByName = createdBy.name;
postAtts.lastPostUrl = topic.get("lastPostUrl");
postAtts.lastPostUsername = details.last_poster.username;
postAtts.lastPostAvatarTemplate = details.last_poster.avatar_template;
postAtts.lastPostName = details.last_poster.name;
if (details.last_poster) {
postAtts.lastPostUsername = details.last_poster.username;
postAtts.lastPostAvatarTemplate = details.last_poster.avatar_template;
postAtts.lastPostName = details.last_poster.name;
}
postAtts.lastPostAt = topic.last_posted_at;
postAtts.topicReplyCount = topic.get("replyCount");