From ff31403a60332ceeb89d37fed695966cc2fb8b22 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Mon, 29 Feb 2016 11:31:30 -0500 Subject: [PATCH] FIX: When cloaked, posts would break jumping to top/bottom --- app/assets/javascripts/discourse/lib/url.js.es6 | 2 +- app/assets/javascripts/discourse/widgets/post.js.es6 | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/discourse/lib/url.js.es6 b/app/assets/javascripts/discourse/lib/url.js.es6 index 3c76d4f5144..b5572ef0a78 100644 --- a/app/assets/javascripts/discourse/lib/url.js.es6 +++ b/app/assets/javascripts/discourse/lib/url.js.es6 @@ -76,7 +76,7 @@ const DiscourseURL = Ember.Object.createWithMixins({ }, // Scroll to the same page, different anchor - scrollToId: function(id) { + scrollToId(id) { if (Em.isEmpty(id)) { return; } _jumpScheduled = true; diff --git a/app/assets/javascripts/discourse/widgets/post.js.es6 b/app/assets/javascripts/discourse/widgets/post.js.es6 index bc0510ea91d..be6ed28ad10 100644 --- a/app/assets/javascripts/discourse/widgets/post.js.es6 +++ b/app/assets/javascripts/discourse/widgets/post.js.es6 @@ -379,9 +379,11 @@ export default createWidget('post', { shadowTree: true, buildAttributes(attrs) { - if (attrs.cloaked) { - return { style: `height: ${attrs.height}px` }; - } + return attrs.cloaked ? { style: `height: ${attrs.height}px` } : undefined; + }, + + buildId(attrs) { + return attrs.cloaked ? `post_${attrs.post_number}` : undefined; }, buildClasses(attrs) {