mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 13:39:42 +08:00
FEATURE: add before
topic list filter
This commit is contained in:
parent
872d9eae45
commit
4dac4c69a6
|
@ -7,7 +7,8 @@ export const queryParams = {
|
|||
search: { replace: true, refreshModel: true },
|
||||
max_posts: { replace: true, refreshModel: true },
|
||||
q: { replace: true, refreshModel: true },
|
||||
tags: { replace: true }
|
||||
tags: { replace: true },
|
||||
before: { replace: true, refreshModel: true}
|
||||
};
|
||||
|
||||
// Basic controller options
|
||||
|
|
|
@ -13,6 +13,7 @@ class TopicQuery
|
|||
def self.public_valid_options
|
||||
@public_valid_options ||=
|
||||
%i(page
|
||||
before
|
||||
topic_ids
|
||||
exclude_category_ids
|
||||
category
|
||||
|
@ -592,6 +593,13 @@ class TopicQuery
|
|||
end
|
||||
|
||||
require_deleted_clause = true
|
||||
|
||||
if before = options[:before]
|
||||
if (before = before.to_i) > 0
|
||||
result = result.where('topics.created_at < ?', before.to_i.days.ago)
|
||||
end
|
||||
end
|
||||
|
||||
if status = options[:status]
|
||||
case status
|
||||
when 'open'
|
||||
|
|
Loading…
Reference in New Issue
Block a user