0
0
Fork 0

Convert /instances/* controller specs to request specs (#27988)

Co-authored-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
Matt Jankowski 2023-11-20 06:05:28 -05:00 committed by GitHub
parent 718c95e7af
commit 876f5b1d12
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 349 additions and 192 deletions

View file

@ -19,7 +19,19 @@ class Api::V1::Instances::DomainBlocksController < Api::V1::Instances::BaseContr
private
def require_enabled_api!
head 404 unless Setting.show_domain_blocks == 'all' || (Setting.show_domain_blocks == 'users' && user_signed_in?)
head 404 unless api_enabled?
end
def api_enabled?
show_domain_blocks_for_all? || show_domain_blocks_to_user?
end
def show_domain_blocks_for_all?
Setting.show_domain_blocks == 'all'
end
def show_domain_blocks_to_user?
Setting.show_domain_blocks == 'users' && user_signed_in?
end
def set_domain_blocks