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 },
|
max_posts: { replace: true, refreshModel: true },
|
||||||
q: { replace: true, refreshModel: true },
|
q: { replace: true, refreshModel: true },
|
||||||
tags: { replace: true },
|
tags: { replace: true },
|
||||||
before: { replace: true, refreshModel: true}
|
before: { replace: true, refreshModel: true},
|
||||||
|
bumped_before: { replace: true, refreshModel: true}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Basic controller options
|
// Basic controller options
|
||||||
|
|
|
@ -14,6 +14,7 @@ class TopicQuery
|
||||||
@public_valid_options ||=
|
@public_valid_options ||=
|
||||||
%i(page
|
%i(page
|
||||||
before
|
before
|
||||||
|
bumped_before
|
||||||
topic_ids
|
topic_ids
|
||||||
exclude_category_ids
|
exclude_category_ids
|
||||||
category
|
category
|
||||||
|
@ -600,6 +601,12 @@ class TopicQuery
|
||||||
end
|
end
|
||||||
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]
|
if status = options[:status]
|
||||||
case status
|
case status
|
||||||
when 'open'
|
when 'open'
|
||||||
|
|
Loading…
Reference in New Issue