mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
FIX: Make sure reset-new for tracked is not limited by per_page count (#13395)
When dismissing new topics for the Tracked filter, the dismiss was limited to 30 topics which is the default per page count for TopicQuery. This happened even if you specified which topic IDs you were selectively dismissing. This PR fixes that bug, and also moves the per_page_count into a DEFAULT_PER_PAGE_COUNT for the TopicQuery so it can be stubbed in tests. Also moves the unused stub_const method into the spec helpers for cases like this; it is much better to handle this in one place with an ensure. In a follow up PR I will clean up other specs that do the same thing and make them use stub_const.
This commit is contained in:
@ -7,6 +7,7 @@
|
||||
|
||||
class TopicQuery
|
||||
PG_MAX_INT ||= 2147483647
|
||||
DEFAULT_PER_PAGE_COUNT ||= 30
|
||||
|
||||
def self.validators
|
||||
@validators ||= begin
|
||||
@ -578,7 +579,7 @@ class TopicQuery
|
||||
protected
|
||||
|
||||
def per_page_setting
|
||||
30
|
||||
DEFAULT_PER_PAGE_COUNT
|
||||
end
|
||||
|
||||
def private_messages_for(user, type)
|
||||
@ -702,7 +703,7 @@ class TopicQuery
|
||||
# Create results based on a bunch of default options
|
||||
def default_results(options = {})
|
||||
options.reverse_merge!(@options)
|
||||
options.reverse_merge!(per_page: per_page_setting)
|
||||
options.reverse_merge!(per_page: per_page_setting) unless options[:limit] == false
|
||||
|
||||
# Whether to return visible topics
|
||||
options[:visible] = true if @user.nil? || @user.regular?
|
||||
|
Reference in New Issue
Block a user