mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Add per_page as public param for TopicQuery (#30716)
This change allows controllers that construct TopicQuery parameters, to pass per_page into the TopicQuery constructor as an option. I can't see why this shouldn't be a public param, so long as we properly validate the value! Internal discussion at t/145686.
This commit is contained in:
committed by
GitHub
parent
473e37e7b3
commit
a89086f799
@@ -322,7 +322,8 @@ class ListController < ApplicationController
|
||||
define_method("top_#{period}") do |options = nil|
|
||||
top_options = build_topic_list_options
|
||||
top_options.merge!(options) if options
|
||||
top_options[:per_page] = SiteSetting.topics_per_period_in_top_page
|
||||
top_options[:per_page] = top_options[:per_page].presence ||
|
||||
SiteSetting.topics_per_period_in_top_page
|
||||
|
||||
user = list_target_user
|
||||
list = TopicQuery.new(user, top_options).list_top_for(period)
|
||||
|
||||
Reference in New Issue
Block a user