Updated Explore,Group,GroupCollection timeline controllers unauth result limits
• Updated: - Explore,Group,GroupCollection timeline controllers unauth result limits to be max 2 pages (group still empty for now) - Max limit to be 25 (for everything, unless provided default) in BaseController
This commit is contained in:
parent
409bb05adb
commit
2c5676a2fc
@ -5,6 +5,8 @@ class Api::BaseController < ApplicationController
|
|||||||
DEFAULT_ACCOUNTS_LIMIT = 20
|
DEFAULT_ACCOUNTS_LIMIT = 20
|
||||||
DEFAULT_CHAT_CONVERSATION_LIMIT = 100
|
DEFAULT_CHAT_CONVERSATION_LIMIT = 100
|
||||||
DEFAULT_CHAT_CONVERSATION_MESSAGE_LIMIT = 20
|
DEFAULT_CHAT_CONVERSATION_MESSAGE_LIMIT = 20
|
||||||
|
MAX_LIMIT_PARAM = 25
|
||||||
|
MIN_UNAUTHENTICATED_PAGES = 2
|
||||||
|
|
||||||
include RateLimitHeaders
|
include RateLimitHeaders
|
||||||
|
|
||||||
@ -55,7 +57,7 @@ class Api::BaseController < ApplicationController
|
|||||||
|
|
||||||
def limit_param(default_limit)
|
def limit_param(default_limit)
|
||||||
return default_limit unless params[:limit]
|
return default_limit unless params[:limit]
|
||||||
[params[:limit].to_i.abs, default_limit * 2].min
|
[params[:limit].to_i.abs, MAX_LIMIT_PARAM].min
|
||||||
end
|
end
|
||||||
|
|
||||||
def params_slice(*keys)
|
def params_slice(*keys)
|
||||||
|
@ -48,7 +48,8 @@ class Api::V1::Timelines::ExploreController < Api::BaseController
|
|||||||
FeedManager.instance.filter?(:home, status, current_account.id)
|
FeedManager.instance.filter?(:home, status, current_account.id)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
SortingQueryBuilder.new.call(@sort_type, nil, params[:page])
|
page = [params[:page].to_i.abs, MIN_UNAUTHENTICATED_PAGES].min
|
||||||
|
SortingQueryBuilder.new.call(@sort_type, nil, page)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -71,7 +71,8 @@ class Api::V1::Timelines::GroupCollectionController < Api::BaseController
|
|||||||
FeedManager.instance.filter?(:home, status, current_account.id)
|
FeedManager.instance.filter?(:home, status, current_account.id)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
SortingQueryBuilder.new.call(@sort_type, @groupIds, params[:page])
|
page = [params[:page].to_i.abs, MIN_UNAUTHENTICATED_PAGES].min
|
||||||
|
SortingQueryBuilder.new.call(@sort_type, @groupIds, page)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -55,7 +55,8 @@ class Api::V1::Timelines::GroupController < Api::BaseController
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
return []
|
return []
|
||||||
# SortingQueryBuilder.new.call(@sort_type, @group, params[:page])
|
# page = [params[:page].to_i.abs, MIN_UNAUTHENTICATED_PAGES].min
|
||||||
|
# SortingQueryBuilder.new.call(@sort_type, @group, page)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user