buggy is reply directly below
This commit is contained in:
parent
4d4a5735d2
commit
d3cfb56000
|
@ -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')
|
||||
|
||||
});
|
||||
|
|
|
@ -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); });
|
||||
});
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in New Issue