[group_collection_controller] add 7 day date constraint to main query.
This commit is contained in:
parent
2a9bec5ec2
commit
3fcf7fee0d
@ -72,7 +72,7 @@ class Api::V1::Timelines::GroupCollectionController < Api::BaseController
|
|||||||
return []
|
return []
|
||||||
end
|
end
|
||||||
|
|
||||||
date_limit = 30.days.ago
|
date_limit = 7.days.ago
|
||||||
top_order = 'status_stats.favourites_count DESC, status_stats.reblogs_count DESC, status_stats.replies_count DESC'
|
top_order = 'status_stats.favourites_count DESC, status_stats.reblogs_count DESC, status_stats.replies_count DESC'
|
||||||
|
|
||||||
if @sort_type == 'hot'
|
if @sort_type == 'hot'
|
||||||
@ -94,6 +94,8 @@ class Api::V1::Timelines::GroupCollectionController < Api::BaseController
|
|||||||
if @sort_type == 'newest'
|
if @sort_type == 'newest'
|
||||||
statuses = Status.where(
|
statuses = Status.where(
|
||||||
group: @groupIds, reply: false
|
group: @groupIds, reply: false
|
||||||
|
).where(
|
||||||
|
'statuses.updated_at > ?', date_limit
|
||||||
).paginate_by_id(
|
).paginate_by_id(
|
||||||
limit_param(DEFAULT_STATUSES_LIMIT),
|
limit_param(DEFAULT_STATUSES_LIMIT),
|
||||||
params_slice(:max_id, :since_id, :min_id)
|
params_slice(:max_id, :since_id, :min_id)
|
||||||
@ -131,6 +133,8 @@ class Api::V1::Timelines::GroupCollectionController < Api::BaseController
|
|||||||
if @sort_type == 'newest'
|
if @sort_type == 'newest'
|
||||||
statuses = Status.where(
|
statuses = Status.where(
|
||||||
group: @groupIds, reply: false
|
group: @groupIds, reply: false
|
||||||
|
).where(
|
||||||
|
'statuses.created_at > ?', date_limit
|
||||||
).paginate_by_id(limit_param(DEFAULT_STATUSES_LIMIT), params_slice(:max_id, :since_id, :min_id))
|
).paginate_by_id(limit_param(DEFAULT_STATUSES_LIMIT), params_slice(:max_id, :since_id, :min_id))
|
||||||
elsif @sort_type == 'recent'
|
elsif @sort_type == 'recent'
|
||||||
statuses = Status.where(
|
statuses = Status.where(
|
||||||
|
Loading…
Reference in New Issue
Block a user