FEATURE: add bumped_before query param for topic list

This commit is contained in:
Sam 2017-03-02 15:11:38 -05:00
parent ca20cb9941
commit abc4dff0fe
2 changed files with 9 additions and 1 deletions

View File

@ -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

View File

@ -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'