diff --git a/app/assets/javascripts/discourse/widgets/post-small-action.js.es6 b/app/assets/javascripts/discourse/widgets/post-small-action.js.es6 index c0dcea64e..4940b6446 100644 --- a/app/assets/javascripts/discourse/widgets/post-small-action.js.es6 +++ b/app/assets/javascripts/discourse/widgets/post-small-action.js.es6 @@ -24,6 +24,7 @@ const icons = { }; export default createWidget('post-small-action', { + buildKey: attrs => `post-small-act-${attrs.id}`, tagName: 'div.small-action.onscreen-post.clearfix', buildId(attrs) { diff --git a/app/assets/javascripts/discourse/widgets/post-stream.js.es6 b/app/assets/javascripts/discourse/widgets/post-stream.js.es6 index d000aa321..404d4fd86 100644 --- a/app/assets/javascripts/discourse/widgets/post-stream.js.es6 +++ b/app/assets/javascripts/discourse/widgets/post-stream.js.es6 @@ -1,7 +1,6 @@ import { createWidget } from 'discourse/widgets/widget'; import transformPost from 'discourse/lib/transform-post'; import { Placeholder } from 'discourse/lib/posts-with-placeholders'; -import { h } from 'virtual-dom'; import { addWidgetCleanCallback } from 'discourse/components/mount-widget'; const CLOAKING_ENABLED = !window.inTestEnv; @@ -86,9 +85,11 @@ export default createWidget('post-stream', { const height = _cloaked[post.id]; if (height) { - result.push(h('div.cloaked-post', { id: `post_${post.post_number}`, - attributes: { style: `height: ${height}px` } })); - } else if (transformed.isSmallAction) { + transformed.cloaked = true; + transformed.height = height; + } + + if (transformed.isSmallAction) { result.push(this.attach('post-small-action', transformed, { model: post })); } else { result.push(this.attach('post', transformed, { model: post })); diff --git a/app/assets/javascripts/discourse/widgets/post.js.es6 b/app/assets/javascripts/discourse/widgets/post.js.es6 index 2952479d2..3c1148f8d 100644 --- a/app/assets/javascripts/discourse/widgets/post.js.es6 +++ b/app/assets/javascripts/discourse/widgets/post.js.es6 @@ -378,7 +378,14 @@ export default createWidget('post', { buildKey: attrs => `post-${attrs.id}`, shadowTree: true, + buildAttributes(attrs) { + if (attrs.cloaked) { + return { style: `height: ${attrs.height}px` }; + } + }, + buildClasses(attrs) { + if (attrs.cloaked) { return 'cloaked-post'; } const classNames = ['topic-post', 'clearfix']; if (attrs.selected) { classNames.push('selected'); } @@ -397,6 +404,8 @@ export default createWidget('post', { }, html(attrs) { + if (attrs.cloaked) { return 'cloaked'; } + return this.attach('post-article', attrs); },