From 744add9ecee66ab83a04536516dd8c8b7be015dd Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Mon, 9 Dec 2013 14:28:32 -0500 Subject: [PATCH] FIX: Post count progress was a little off. Minor fix to hidden posts --- .../javascripts/discourse/controllers/topic_controller.js | 4 ++-- app/assets/javascripts/discourse/views/post_view.js | 2 +- lib/topic_view.rb | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/discourse/controllers/topic_controller.js b/app/assets/javascripts/discourse/controllers/topic_controller.js index 5d31dccb2ce..8fb34a56026 100644 --- a/app/assets/javascripts/discourse/controllers/topic_controller.js +++ b/app/assets/javascripts/discourse/controllers/topic_controller.js @@ -275,9 +275,9 @@ Discourse.TopicController = Discourse.ObjectController.extend(Discourse.Selected streamPercentage: function() { if (!this.get('postStream.loaded')) { return 0; } if (this.get('postStream.highest_post_number') === 0) { return 0; } - var perc = this.get('progressPosition') / this.get('highest_post_number'); + var perc = this.get('progressPosition') / this.get('filteredPostsCount'); return (perc > 1.0) ? 1.0 : perc; - }.property('postStream.loaded', 'progressPosition', 'highest_post_number'), + }.property('postStream.loaded', 'progressPosition', 'filteredPostsCount'), multiSelectChanged: function() { // Deselect all posts when multi select is turned off diff --git a/app/assets/javascripts/discourse/views/post_view.js b/app/assets/javascripts/discourse/views/post_view.js index 0d8a677e347..df9928c6407 100644 --- a/app/assets/javascripts/discourse/views/post_view.js +++ b/app/assets/javascripts/discourse/views/post_view.js @@ -11,7 +11,7 @@ Discourse.PostView = Discourse.GroupedView.extend(Ember.Evented, { templateName: 'post', classNameBindings: ['postTypeClass', 'selected', - 'post.hidden:hidden', + 'post.hidden:deleted', 'post.deleted'], postBinding: 'content', diff --git a/lib/topic_view.rb b/lib/topic_view.rb index 4519e96bc42..0ef5c7a2d07 100644 --- a/lib/topic_view.rb +++ b/lib/topic_view.rb @@ -264,7 +264,8 @@ class TopicView end def unfiltered_posts - result = @topic.posts.where(hidden: false) + result = @topic.posts + result = result.where(hidden: false) unless @user.try(:staff?) result = result.with_deleted if @user.try(:staff?) result end