Skip to content

Commit

Permalink
Fix the build.
Browse files Browse the repository at this point in the history
  • Loading branch information
tgxworld committed Sep 7, 2017
1 parent 3e123b1 commit e0d5d96
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
2 changes: 1 addition & 1 deletion lib/filter_best_posts.rb
Expand Up @@ -59,7 +59,7 @@ def filter_posts_based_on_score
end

def sort_posts
@posts.to_a.sort! { |a, b| a.post_number <=> b.post_number }
@posts = Post.from(@posts, :posts).order(post_number: :asc)
end

end
12 changes: 2 additions & 10 deletions lib/topic_view.rb
Expand Up @@ -66,7 +66,7 @@ def initialize(topic_id, user = nil, options = {})

filter_posts(options)

if @posts
if @posts.present?
if (added_fields = User.whitelisted_user_custom_fields(@guardian)).present?
@user_custom_fields = User.custom_fields_for_ids(@posts.pluck(:user_id), added_fields)
end
Expand Down Expand Up @@ -331,14 +331,6 @@ def recent_posts
@filtered_posts.by_newest.with_user.first(25)
end

def current_post_ids
@current_post_ids ||= if @posts.is_a?(Array)
@posts.map { |p| p.id }
else
@posts.pluck(:post_number)
end
end

# Returns an array of [id, post_number, days_ago] tuples.
# `days_ago` is there for the timeline calculations.
def filtered_post_stream
Expand All @@ -361,7 +353,7 @@ def read_posts_set

post_numbers = PostTiming
.where(topic_id: @topic.id, user_id: @user.id)
.where(post_number: current_post_ids)
.where(post_number: @posts.pluck(:post_number))
.pluck(:post_number)

post_numbers.each { |pn| result << pn }
Expand Down

1 comment on commit e0d5d96

@discoursebot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/discourse-version-1-9/61289/6

Please sign in to comment.