mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-13 15:58:50 +00:00
Merge commit 'ad95c98054574080ac5d15584b3018d1db836531' into glitch-soc/merge-upstream
Conflicts: - `package.json`: Upstream removed their direct dependency `autoprefixer`, which was textually adjacent to glitch-soc-only dependency `atrament`. Removed direct dependency on `autoprefixer`. - `yarn.lock`: Upstream removed their direct dependency `autoprefixer`, which was textually adjacent to glitch-soc-only dependency `atrament`. Removed direct dependency on `autoprefixer`.
This commit is contained in:
@@ -5,6 +5,7 @@ class Api::V1::Admin::DomainAllowsController < Api::BaseController
|
||||
include AccountableConcern
|
||||
|
||||
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:write', :'admin:write:domain_allows' }, except: [:index, :show]
|
||||
@@ -47,7 +48,7 @@ class Api::V1::Admin::DomainAllowsController < Api::BaseController
|
||||
private
|
||||
|
||||
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
|
||||
|
||||
def set_domain_allow
|
||||
@@ -67,7 +68,7 @@ class Api::V1::Admin::DomainAllowsController < Api::BaseController
|
||||
end
|
||||
|
||||
def records_continue?
|
||||
@domain_allows.size == limit_param(LIMIT)
|
||||
@domain_allows.size == limit_param(LIMIT, MAX_LIMIT)
|
||||
end
|
||||
|
||||
def resource_params
|
||||
|
||||
@@ -5,6 +5,7 @@ class Api::V1::Admin::DomainBlocksController < Api::BaseController
|
||||
include AccountableConcern
|
||||
|
||||
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:write', :'admin:write:domain_blocks' }, except: [:index, :show]
|
||||
@@ -59,7 +60,7 @@ class Api::V1::Admin::DomainBlocksController < Api::BaseController
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
def set_domain_block
|
||||
@@ -83,7 +84,7 @@ class Api::V1::Admin::DomainBlocksController < Api::BaseController
|
||||
end
|
||||
|
||||
def records_continue?
|
||||
@domain_blocks.size == limit_param(LIMIT)
|
||||
@domain_blocks.size == limit_param(LIMIT, MAX_LIMIT)
|
||||
end
|
||||
|
||||
def resource_params
|
||||
|
||||
@@ -5,7 +5,8 @@ class Api::V1::Notifications::RequestsController < Api::BaseController
|
||||
before_action -> { doorkeeper_authorize! :write, :'write:notifications' }, except: :index
|
||||
|
||||
before_action :require_user!
|
||||
before_action :set_request, except: :index
|
||||
before_action :set_request, only: [:show, :accept, :dismiss]
|
||||
before_action :set_requests, only: [:accept_bulk, :dismiss_bulk]
|
||||
|
||||
after_action :insert_pagination_headers, only: :index
|
||||
|
||||
@@ -32,6 +33,16 @@ class Api::V1::Notifications::RequestsController < Api::BaseController
|
||||
render_empty
|
||||
end
|
||||
|
||||
def accept_bulk
|
||||
@requests.each { |request| AcceptNotificationRequestService.new.call(request) }
|
||||
render_empty
|
||||
end
|
||||
|
||||
def dismiss_bulk
|
||||
@requests.each(&:destroy!)
|
||||
render_empty
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def load_requests
|
||||
@@ -53,6 +64,10 @@ class Api::V1::Notifications::RequestsController < Api::BaseController
|
||||
@request = NotificationRequest.where(account: current_account).find(params[:id])
|
||||
end
|
||||
|
||||
def set_requests
|
||||
@requests = NotificationRequest.where(account: current_account, id: Array(params[:id]).uniq.map(&:to_i))
|
||||
end
|
||||
|
||||
def next_path
|
||||
api_v1_notifications_requests_url pagination_params(max_id: pagination_max_id) unless @requests.empty?
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user