FIX: decorateCooked was not being applied to embedded posts

This commit is contained in:
Robin Ward 2015-06-01 11:58:17 -04:00
parent 81a699e2b0
commit b2a7411620
4 changed files with 10 additions and 12 deletions

View File

@ -11,6 +11,6 @@ export function decorateCooked(container, cb) {
decorate(postView, 'postViewInserted', cb); decorate(postView, 'postViewInserted', cb);
decorate(postView, 'postViewUpdated', cb); decorate(postView, 'postViewUpdated', cb);
decorate(container.lookupFactory('view:composer'), 'previewRefreshed', 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); decorate(container.lookupFactory('view:user-stream'), 'didInsertElement', cb);
} }

View File

@ -16,6 +16,5 @@
<div class='cooked'> <div class='cooked'>
{{{unbound cooked}}} {{{unbound cooked}}}
</div> </div>
</div> </div>
</div> </div>

View File

@ -1,9 +1,9 @@
export default Discourse.GroupedView.extend({ export default Discourse.GroupedView.extend({
templateName: 'embedded_post', templateName: 'embedded-post',
classNames: ['reply'], classNames: ['reply'],
_startTracking: function() { _startTracking: function() {
var post = this.get('content'); const post = this.get('content');
Discourse.ScreenTrack.current().track(this.get('elementId'), post.get('post_number')); Discourse.ScreenTrack.current().track(this.get('elementId'), post.get('post_number'));
}.on('didInsertElement'), }.on('didInsertElement'),

View File

@ -185,7 +185,6 @@ const PostView = Discourse.GroupedView.extend(Ember.Evented, {
actions: { actions: {
// Toggle the replies this post is a reply to // Toggle the replies this post is a reply to
toggleReplyHistory(post) { toggleReplyHistory(post) {
const replyHistory = post.get('replyHistory'), const replyHistory = post.get('replyHistory'),
topicController = this.get('controller'), topicController = this.get('controller'),
origScrollTop = $(window).scrollTop(), origScrollTop = $(window).scrollTop(),
@ -198,7 +197,7 @@ const PostView = Discourse.GroupedView.extend(Ember.Evented, {
return; return;
} }
const stream = topicController.get('postStream'); const stream = topicController.get('model.postStream');
const offsetFromTop = this.$().position().top - $(window).scrollTop(); const offsetFromTop = this.$().position().top - $(window).scrollTop();
if(Discourse.SiteSettings.experimental_reply_expansion) { if(Discourse.SiteSettings.experimental_reply_expansion) {
@ -223,7 +222,7 @@ const PostView = Discourse.GroupedView.extend(Ember.Evented, {
} else { } else {
post.set('loadingReplyHistory', true); post.set('loadingReplyHistory', true);
topicController.get('postStream').findReplyHistory(post).then(function () { stream.findReplyHistory(post).then(function () {
post.set('loadingReplyHistory', false); post.set('loadingReplyHistory', false);
Em.run.next(function() { Em.run.next(function() {