Skip to content

Commit

Permalink
buggy is reply directly below
Browse files Browse the repository at this point in the history
  • Loading branch information
SamSaffron committed Jul 3, 2013
1 parent 4d4a573 commit d3cfb56
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions app/assets/javascripts/discourse/models/post.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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')

});
Expand Down
6 changes: 3 additions & 3 deletions app/assets/javascripts/discourse/models/topic.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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); });
});
},

Expand Down

0 comments on commit d3cfb56

Please sign in to comment.