From 015eb47ea09bd2944bd2b7d79dba93f6622ea8bf Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Wed, 24 Feb 2016 10:44:27 -0500 Subject: [PATCH] Don't pass `topic` down to the widgets --- app/assets/javascripts/discourse/lib/transform-post.js.es6 | 3 +-- app/assets/javascripts/discourse/widgets/post-cooked.js.es6 | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/discourse/lib/transform-post.js.es6 b/app/assets/javascripts/discourse/lib/transform-post.js.es6 index c65bdf21bb2..b3379004edc 100644 --- a/app/assets/javascripts/discourse/lib/transform-post.js.es6 +++ b/app/assets/javascripts/discourse/lib/transform-post.js.es6 @@ -85,7 +85,6 @@ export default function transformPost(currentUser, site, post, prevPost, nextPos const postAtts = transformBasicPost(post); - postAtts.topic = topic; postAtts.topicId = topic.id; postAtts.topicOwner = details.created_by.id === post.user_id; postAtts.post_type = postType; @@ -105,6 +104,7 @@ export default function transformPost(currentUser, site, post, prevPost, nextPos postAtts.actionCode = post.action_code; postAtts.actionCodeWho = post.action_code_who; postAtts.userCustomFields = post.user_custom_fields; + postAtts.topicUrl = topic.get('url'); const showPMMap = topic.archetype === 'private_message' && post.post_number === 1; if (showPMMap) { @@ -118,7 +118,6 @@ export default function transformPost(currentUser, site, post, prevPost, nextPos const showTopicMap = showPMMap || (post.post_number === 1 && topic.archetype === 'regular' && topic.posts_count > 1); if (showTopicMap) { postAtts.showTopicMap = true; - postAtts.topicUrl = topic.get('url'); postAtts.topicCreatedAt = topic.created_at; postAtts.createdByUsername = details.created_by.username; postAtts.createdByAvatarTemplate = details.created_by.avatar_template; diff --git a/app/assets/javascripts/discourse/widgets/post-cooked.js.es6 b/app/assets/javascripts/discourse/widgets/post-cooked.js.es6 index b8d5cd06f95..f98a90eb1da 100644 --- a/app/assets/javascripts/discourse/widgets/post-cooked.js.es6 +++ b/app/assets/javascripts/discourse/widgets/post-cooked.js.es6 @@ -145,7 +145,7 @@ export default class PostCooked { } _urlForPostNumber(postNumber) { - return (postNumber > 0) ? `${this.attrs.topic.get('url')}/${postNumber}` : this.attrs.topic.get('url'); + return (postNumber > 0) ? `${this.attrs.topicUrl}/${postNumber}` : this.attrs.topicUrl; } _updateQuoteElements($aside, desc) {