mirror of
https://github.com/funamitech/mastodon
synced 2024-12-01 08:18:53 +09:00
Increase maximum page size for Admin Domain Management APIs (#31253)
This commit is contained in:
parent
d19edc4c4a
commit
f55099fea3
@ -5,6 +5,7 @@ class Api::V1::Admin::DomainAllowsController < Api::BaseController
|
|||||||
include AccountableConcern
|
include AccountableConcern
|
||||||
|
|
||||||
LIMIT = 100
|
LIMIT = 100
|
||||||
|
MAX_LIMIT = 500
|
||||||
|
|
||||||
before_action -> { authorize_if_got_token! :'admin:read', :'admin:read:domain_allows' }, only: [:index, :show]
|
before_action -> { authorize_if_got_token! :'admin:read', :'admin:read:domain_allows' }, only: [:index, :show]
|
||||||
before_action -> { authorize_if_got_token! :'admin:write', :'admin:write:domain_allows' }, except: [:index, :show]
|
before_action -> { authorize_if_got_token! :'admin:write', :'admin:write:domain_allows' }, except: [:index, :show]
|
||||||
@ -47,7 +48,7 @@ class Api::V1::Admin::DomainAllowsController < Api::BaseController
|
|||||||
private
|
private
|
||||||
|
|
||||||
def set_domain_allows
|
def set_domain_allows
|
||||||
@domain_allows = DomainAllow.order(id: :desc).to_a_paginated_by_id(limit_param(LIMIT), params_slice(:max_id, :since_id, :min_id))
|
@domain_allows = DomainAllow.order(id: :desc).to_a_paginated_by_id(limit_param(LIMIT, MAX_LIMIT), params_slice(:max_id, :since_id, :min_id))
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_domain_allow
|
def set_domain_allow
|
||||||
@ -67,7 +68,7 @@ class Api::V1::Admin::DomainAllowsController < Api::BaseController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def records_continue?
|
def records_continue?
|
||||||
@domain_allows.size == limit_param(LIMIT)
|
@domain_allows.size == limit_param(LIMIT, MAX_LIMIT)
|
||||||
end
|
end
|
||||||
|
|
||||||
def resource_params
|
def resource_params
|
||||||
|
@ -5,6 +5,7 @@ class Api::V1::Admin::DomainBlocksController < Api::BaseController
|
|||||||
include AccountableConcern
|
include AccountableConcern
|
||||||
|
|
||||||
LIMIT = 100
|
LIMIT = 100
|
||||||
|
MAX_LIMIT = 500
|
||||||
|
|
||||||
before_action -> { authorize_if_got_token! :'admin:read', :'admin:read:domain_blocks' }, only: [:index, :show]
|
before_action -> { authorize_if_got_token! :'admin:read', :'admin:read:domain_blocks' }, only: [:index, :show]
|
||||||
before_action -> { authorize_if_got_token! :'admin:write', :'admin:write:domain_blocks' }, except: [:index, :show]
|
before_action -> { authorize_if_got_token! :'admin:write', :'admin:write:domain_blocks' }, except: [:index, :show]
|
||||||
@ -59,7 +60,7 @@ class Api::V1::Admin::DomainBlocksController < Api::BaseController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def set_domain_blocks
|
def set_domain_blocks
|
||||||
@domain_blocks = DomainBlock.order(id: :desc).to_a_paginated_by_id(limit_param(LIMIT), params_slice(:max_id, :since_id, :min_id))
|
@domain_blocks = DomainBlock.order(id: :desc).to_a_paginated_by_id(limit_param(LIMIT, MAX_LIMIT), params_slice(:max_id, :since_id, :min_id))
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_domain_block
|
def set_domain_block
|
||||||
@ -83,7 +84,7 @@ class Api::V1::Admin::DomainBlocksController < Api::BaseController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def records_continue?
|
def records_continue?
|
||||||
@domain_blocks.size == limit_param(LIMIT)
|
@domain_blocks.size == limit_param(LIMIT, MAX_LIMIT)
|
||||||
end
|
end
|
||||||
|
|
||||||
def resource_params
|
def resource_params
|
||||||
|
Loading…
Reference in New Issue
Block a user