FIX: Removed some leftover posts references outside of the stream

This commit is contained in:
Robin Ward 2013-07-03 11:29:29 -04:00
parent f328804488
commit c7ac11458b
3 changed files with 2 additions and 23 deletions

View File

@ -90,7 +90,7 @@ Discourse.TopicController = Discourse.ObjectController.extend(Discourse.Selected
}, },
selectAll: function() { selectAll: function() {
var posts = this.get('posts'); var posts = this.get('postStream.posts');
var selectedPosts = this.get('selectedPosts'); var selectedPosts = this.get('selectedPosts');
if (posts) { if (posts) {
selectedPosts.addObjects(posts); selectedPosts.addObjects(posts);

View File

@ -79,26 +79,6 @@ Discourse.Topic = Discourse.Model.extend({
return this.urlForPostNumber(this.get('highest_post_number')); return this.urlForPostNumber(this.get('highest_post_number'));
}.property('url', 'highest_post_number'), }.property('url', 'highest_post_number'),
// The last post in the topic
lastPost: function() {
var posts = this.get('posts');
return posts[posts.length-1];
},
postsChanged: function() {
var last, posts;
posts = this.get('posts');
last = posts[posts.length - 1];
if (!(last && last.set && !last.lastPost)) return;
_.each(posts,function(p) {
if (p.lastPost) {
p.set('lastPost', false);
}
});
last.set('lastPost', true);
return true;
}.observes('posts.@each', 'posts'),
// The amount of new posts to display. It might be different than what the server // The amount of new posts to display. It might be different than what the server
// tells us if we are still asynchronously flushing our "recently read" data. // tells us if we are still asynchronously flushing our "recently read" data.
// So take what the browser has seen into consideration. // So take what the browser has seen into consideration.

View File

@ -9,8 +9,7 @@
Discourse.PostView = Discourse.View.extend({ Discourse.PostView = Discourse.View.extend({
classNames: ['topic-post', 'clearfix'], classNames: ['topic-post', 'clearfix'],
templateName: 'post', templateName: 'post',
classNameBindings: ['post.lastPost', classNameBindings: ['postTypeClass',
'postTypeClass',
'selected', 'selected',
'post.hidden:hidden', 'post.hidden:hidden',
'post.deleted_at:deleted', 'post.deleted_at:deleted',