mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 16:41:08 +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:
@ -63,7 +63,7 @@ class TopicsController < ApplicationController
|
||||
# arrays are not supported
|
||||
params[:page] = params[:page].to_i rescue 1
|
||||
|
||||
opts = params.slice(:username_filters, :filter, :page, :post_number, :show_deleted, :replies_to_post_number, :filter_upwards_post_id)
|
||||
opts = params.slice(:username_filters, :filter, :page, :post_number, :show_deleted, :replies_to_post_number, :filter_upwards_post_id, :filter_top_level_replies)
|
||||
username_filters = opts[:username_filters]
|
||||
|
||||
opts[:print] = true if params[:print].present?
|
||||
@ -1221,7 +1221,7 @@ class TopicsController < ApplicationController
|
||||
scope: guardian,
|
||||
root: false,
|
||||
include_raw: !!params[:include_raw],
|
||||
exclude_suggested_and_related: !!params[:replies_to_post_number] || !!params[:filter_upwards_post_id]
|
||||
exclude_suggested_and_related: !!params[:replies_to_post_number] || !!params[:filter_upwards_post_id] || !!params[:filter_top_level_replies]
|
||||
)
|
||||
|
||||
respond_to do |format|
|
||||
|
Reference in New Issue
Block a user