mirror of
https://github.com/discourse/discourse.git
synced 2024-11-28 19:53:53 -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
|
return
|
||||||
end
|
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 = @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)
|
@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)
|
@posts = @posts.where('posts.score >= ?', min_score)
|
||||||
end
|
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 = @posts.to_a
|
||||||
@posts.sort!{|a,b| a.post_number <=> b.post_number}
|
@posts.sort!{|a,b| a.post_number <=> b.post_number}
|
||||||
@posts
|
@posts
|
||||||
|
Loading…
Reference in New Issue
Block a user