mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 10:20:58 -06:00
FIX: Wordpress route wasn't updating filter count correctly
This commit is contained in:
parent
25d2cbc33f
commit
88ca51bb00
@ -161,6 +161,13 @@ class TopicView
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
if opts[:only_moderator_liked]
|
||||
liked_by_moderators = PostAction.where(post_id: @filtered_posts.pluck(:id), post_action_type_id: PostActionType.types[:like])
|
||||
liked_by_moderators = liked_by_moderators.joins(:user).where('users.moderator').pluck(:post_id)
|
||||
@filtered_posts = @filtered_posts.where(id: liked_by_moderators)
|
||||
end
|
||||
|
||||
@posts = @filtered_posts.order('percent_rank asc, sort_order asc').where("post_number > 1")
|
||||
@posts = @posts.includes(:reply_to_user).includes(:topic).joins(:user).limit(max)
|
||||
|
||||
@ -184,12 +191,6 @@ class TopicView
|
||||
@posts = @posts.where('posts.score >= ?', min_score)
|
||||
end
|
||||
|
||||
if opts[:only_moderator_liked]
|
||||
liked_by_moderators = PostAction.where(post_id: @filtered_posts.pluck(:id), post_action_type_id: PostActionType.types[:like])
|
||||
liked_by_moderators = liked_by_moderators.joins(:user).where('users.moderator').pluck(:post_id)
|
||||
@posts = @posts.where(id: liked_by_moderators)
|
||||
end
|
||||
|
||||
@posts = @posts.to_a
|
||||
@posts.sort!{|a,b| a.post_number <=> b.post_number}
|
||||
@posts
|
||||
|
Loading…
Reference in New Issue
Block a user