From b2a74116207bc4da045c351aeab5df8d692e6f53 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Mon, 1 Jun 2015 11:58:17 -0400 Subject: [PATCH] FIX: `decorateCooked` was not being applied to embedded posts --- .../javascripts/discourse/lib/plugin-api.js.es6 | 2 +- .../{embedded_post.hbs => embedded-post.hbs} | 1 - .../discourse/views/embedded-post.js.es6 | 4 ++-- .../javascripts/discourse/views/post.js.es6 | 15 +++++++-------- 4 files changed, 10 insertions(+), 12 deletions(-) rename app/assets/javascripts/discourse/templates/{embedded_post.hbs => embedded-post.hbs} (99%) diff --git a/app/assets/javascripts/discourse/lib/plugin-api.js.es6 b/app/assets/javascripts/discourse/lib/plugin-api.js.es6 index 621c4bdefe6..5008c963e2d 100644 --- a/app/assets/javascripts/discourse/lib/plugin-api.js.es6 +++ b/app/assets/javascripts/discourse/lib/plugin-api.js.es6 @@ -11,6 +11,6 @@ export function decorateCooked(container, cb) { decorate(postView, 'postViewInserted', cb); decorate(postView, 'postViewUpdated', cb); decorate(container.lookupFactory('view:composer'), 'previewRefreshed', cb); - decorate(container.lookupFactory('view:embedded-post'), 'previewRefreshed', cb); + decorate(container.lookupFactory('view:embedded-post'), 'didInsertElement', cb); decorate(container.lookupFactory('view:user-stream'), 'didInsertElement', cb); } diff --git a/app/assets/javascripts/discourse/templates/embedded_post.hbs b/app/assets/javascripts/discourse/templates/embedded-post.hbs similarity index 99% rename from app/assets/javascripts/discourse/templates/embedded_post.hbs rename to app/assets/javascripts/discourse/templates/embedded-post.hbs index 783657595e8..66366ee5aac 100644 --- a/app/assets/javascripts/discourse/templates/embedded_post.hbs +++ b/app/assets/javascripts/discourse/templates/embedded-post.hbs @@ -16,6 +16,5 @@
{{{unbound cooked}}}
- diff --git a/app/assets/javascripts/discourse/views/embedded-post.js.es6 b/app/assets/javascripts/discourse/views/embedded-post.js.es6 index 1bbeb51104a..4697e439060 100644 --- a/app/assets/javascripts/discourse/views/embedded-post.js.es6 +++ b/app/assets/javascripts/discourse/views/embedded-post.js.es6 @@ -1,9 +1,9 @@ export default Discourse.GroupedView.extend({ - templateName: 'embedded_post', + templateName: 'embedded-post', classNames: ['reply'], _startTracking: function() { - var post = this.get('content'); + const post = this.get('content'); Discourse.ScreenTrack.current().track(this.get('elementId'), post.get('post_number')); }.on('didInsertElement'), diff --git a/app/assets/javascripts/discourse/views/post.js.es6 b/app/assets/javascripts/discourse/views/post.js.es6 index f9b9a122916..af93ef94ad6 100644 --- a/app/assets/javascripts/discourse/views/post.js.es6 +++ b/app/assets/javascripts/discourse/views/post.js.es6 @@ -185,20 +185,19 @@ const PostView = Discourse.GroupedView.extend(Ember.Evented, { actions: { // Toggle the replies this post is a reply to toggleReplyHistory(post) { - const replyHistory = post.get('replyHistory'), - topicController = this.get('controller'), - origScrollTop = $(window).scrollTop(), - replyPostNumber = this.get('post.reply_to_post_number'), - postNumber = this.get('post.post_number'), - self = this; + topicController = this.get('controller'), + origScrollTop = $(window).scrollTop(), + replyPostNumber = this.get('post.reply_to_post_number'), + postNumber = this.get('post.post_number'), + self = this; if (Discourse.Mobile.mobileView) { Discourse.URL.routeTo(this.get('post.topic').urlForPostNumber(replyPostNumber)); return; } - const stream = topicController.get('postStream'); + const stream = topicController.get('model.postStream'); const offsetFromTop = this.$().position().top - $(window).scrollTop(); if(Discourse.SiteSettings.experimental_reply_expansion) { @@ -223,7 +222,7 @@ const PostView = Discourse.GroupedView.extend(Ember.Evented, { } else { post.set('loadingReplyHistory', true); - topicController.get('postStream').findReplyHistory(post).then(function () { + stream.findReplyHistory(post).then(function () { post.set('loadingReplyHistory', false); Em.run.next(function() {