Add LIMIT
constant for api/v1/peers/search
endpoint (#31989)
This commit is contained in:
parent
162f9a3c90
commit
c922af2737
@ -7,6 +7,8 @@ class Api::V1::Peers::SearchController < Api::BaseController
|
|||||||
skip_before_action :require_authenticated_user!, unless: :limited_federation_mode?
|
skip_before_action :require_authenticated_user!, unless: :limited_federation_mode?
|
||||||
skip_around_action :set_locale
|
skip_around_action :set_locale
|
||||||
|
|
||||||
|
LIMIT = 10
|
||||||
|
|
||||||
vary_by ''
|
vary_by ''
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@ -35,10 +37,10 @@ class Api::V1::Peers::SearchController < Api::BaseController
|
|||||||
field: 'accounts_count',
|
field: 'accounts_count',
|
||||||
modifier: 'log2p',
|
modifier: 'log2p',
|
||||||
},
|
},
|
||||||
}).limit(10).pluck(:domain)
|
}).limit(LIMIT).pluck(:domain)
|
||||||
else
|
else
|
||||||
domain = normalized_domain
|
domain = normalized_domain
|
||||||
@domains = Instance.searchable.domain_starts_with(domain).limit(10).pluck(:domain)
|
@domains = Instance.searchable.domain_starts_with(domain).limit(LIMIT).pluck(:domain)
|
||||||
end
|
end
|
||||||
rescue Addressable::URI::InvalidURIError
|
rescue Addressable::URI::InvalidURIError
|
||||||
@domains = []
|
@domains = []
|
||||||
|
Loading…
Reference in New Issue
Block a user