mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 06:41:25 +08:00
Top level replies (#16087)
* DEV: Show only top level replies Adds a new query param to the topic view so that we can filter out posts that aren't top level replies. If a post is a reply to another post instead of the original topic post we should not include it in the response if the `filter_top_level_replies` query param is present. * add rspec test
This commit is contained in:
@ -860,6 +860,14 @@ class TopicView
|
||||
@contains_gaps = true
|
||||
end
|
||||
|
||||
# Show Only Top Level Replies
|
||||
if @filter_top_level_replies.present?
|
||||
@filtered_posts = @filtered_posts.where('
|
||||
posts.post_number > 1
|
||||
AND posts.reply_to_post_number IS NULL
|
||||
')
|
||||
end
|
||||
|
||||
# Filtering upwards
|
||||
if @filter_upwards_post_id.present?
|
||||
post = Post.find(@filter_upwards_post_id)
|
||||
|
Reference in New Issue
Block a user