diff --git a/app/assets/javascripts/discourse/models/post_stream.js b/app/assets/javascripts/discourse/models/post_stream.js index bb2c9f4bd..bc6bb317a 100644 --- a/app/assets/javascripts/discourse/models/post_stream.js +++ b/app/assets/javascripts/discourse/models/post_stream.js @@ -64,6 +64,15 @@ Discourse.PostStream = Em.Object.extend({ firstPostNotLoaded: Em.computed.not('firstPostLoaded'), + /** + Returns the id of the last post in the set + + @property lastPostId + **/ + lastPostId: function() { + return _.last(this.get('stream')); + }.property('stream.@each'), + /** Have we loaded the last post in the stream? @@ -71,8 +80,8 @@ Discourse.PostStream = Em.Object.extend({ **/ lastPostLoaded: function() { if (!this.get('hasLoadedData')) { return false; } - return !!this.get('posts').findProperty('id', _.last(this.get('stream'))); - }.property('hasLoadedData', 'posts.[]', 'stream.@each'), + return !!this.get('posts').findProperty('id', this.get('lastPostId')); + }.property('hasLoadedData', 'posts.[]', 'lastPostId'), lastPostNotLoaded: Em.computed.not('lastPostLoaded'), diff --git a/app/assets/javascripts/discourse/templates/topic.js.handlebars b/app/assets/javascripts/discourse/templates/topic.js.handlebars index 45229c211..888f06ab5 100644 --- a/app/assets/javascripts/discourse/templates/topic.js.handlebars +++ b/app/assets/javascripts/discourse/templates/topic.js.handlebars @@ -39,7 +39,7 @@