FEATURE: add bumped_before query param for topic list
This commit is contained in:
parent
ca20cb9941
commit
abc4dff0fe
|
@ -8,7 +8,8 @@ export const queryParams = {
|
|||
max_posts: { replace: true, refreshModel: true },
|
||||
q: { replace: true, refreshModel: true },
|
||||
tags: { replace: true },
|
||||
before: { replace: true, refreshModel: true}
|
||||
before: { replace: true, refreshModel: true},
|
||||
bumped_before: { replace: true, refreshModel: true}
|
||||
};
|
||||
|
||||
// Basic controller options
|
||||
|
|
|
@ -14,6 +14,7 @@ class TopicQuery
|
|||
@public_valid_options ||=
|
||||
%i(page
|
||||
before
|
||||
bumped_before
|
||||
topic_ids
|
||||
exclude_category_ids
|
||||
category
|
||||
|
@ -600,6 +601,12 @@ class TopicQuery
|
|||
end
|
||||
end
|
||||
|
||||
if bumped_before = options[:bumped_before]
|
||||
if (bumped_before = bumped_before.to_i) > 0
|
||||
result = result.where('topics.bumped_at < ?', bumped_before.to_i.days.ago)
|
||||
end
|
||||
end
|
||||
|
||||
if status = options[:status]
|
||||
case status
|
||||
when 'open'
|
||||
|
|
Loading…
Reference in New Issue