From d3cfb56000a0390d098703f61e32c2a1ccd0aa28 Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 3 Jul 2013 16:48:55 +1000 Subject: [PATCH] buggy is reply directly below --- app/assets/javascripts/discourse/models/post.js | 6 +++--- app/assets/javascripts/discourse/models/topic.js | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/discourse/models/post.js b/app/assets/javascripts/discourse/models/post.js index 4a2c734759d..757b23a2a04 100644 --- a/app/assets/javascripts/discourse/models/post.js +++ b/app/assets/javascripts/discourse/models/post.js @@ -267,7 +267,7 @@ Discourse.Post = Discourse.Model.extend({ // Whether to show replies directly below showRepliesBelow: function() { - var reply_count, _ref; + var reply_count, topic; reply_count = this.get('reply_count'); // We don't show replies if there aren't any @@ -280,9 +280,9 @@ Discourse.Post = Discourse.Model.extend({ if (reply_count > 1) return true; // If we have *exactly* one reply, we have to consider if it's directly below us - if ((_ref = this.get('topic')) ? _ref.isReplyDirectlyBelow(this) : void 0) return false; + topic = this.get('topic'); + return !topic.isReplyDirectlyBelow(this); - return true; }.property('reply_count') }); diff --git a/app/assets/javascripts/discourse/models/topic.js b/app/assets/javascripts/discourse/models/topic.js index 56fdfb8f101..6bfdbe89ee2 100644 --- a/app/assets/javascripts/discourse/models/topic.js +++ b/app/assets/javascripts/discourse/models/topic.js @@ -257,14 +257,14 @@ Discourse.Topic = Discourse.Model.extend({ // Is the reply to a post directly below it? isReplyDirectlyBelow: function(post) { var postBelow, posts; - posts = this.get('posts'); + posts = this.get('postStream.posts'); if (!posts) return; postBelow = posts[posts.indexOf(post) + 1]; // If the post directly below's reply_to_post_number is our post number, it's // considered directly below. - return (postBelow ? postBelow.get('reply_to_post_number') : void 0) === post.get('post_number'); + return postBelow && postBelow.get('reply_to_post_number') === post.get('post_number'); }, hasExcerpt: function() { @@ -299,7 +299,7 @@ Discourse.Topic.reopenClass({ **/ findSimilarTo: function(title, body) { return Discourse.ajax("/topics/similar_to", { data: {title: title, raw: body} }).then(function (results) { - return results.map(function(topic) { return Discourse.Topic.create(topic) }); + return results.map(function(topic) { return Discourse.Topic.create(topic); }); }); },