|
|
@ -2,6 +2,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
module Admin
|
|
|
|
module Admin
|
|
|
|
class DomainBlocksController < BaseController
|
|
|
|
class DomainBlocksController < BaseController
|
|
|
|
|
|
|
|
before_action :set_domain_block, only: [:show, :destroy]
|
|
|
|
|
|
|
|
|
|
|
|
def index
|
|
|
|
def index
|
|
|
|
@domain_blocks = DomainBlock.page(params[:page])
|
|
|
|
@domain_blocks = DomainBlock.page(params[:page])
|
|
|
|
end
|
|
|
|
end
|
|
|
@ -21,24 +23,25 @@ module Admin
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def show
|
|
|
|
def show; end
|
|
|
|
@domain_block = DomainBlock.find(params[:id])
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def destroy
|
|
|
|
def destroy
|
|
|
|
@domain_block = DomainBlock.find(params[:id])
|
|
|
|
|
|
|
|
UnblockDomainService.new.call(@domain_block, retroactive_unblock?)
|
|
|
|
UnblockDomainService.new.call(@domain_block, retroactive_unblock?)
|
|
|
|
redirect_to admin_domain_blocks_path, notice: I18n.t('admin.domain_blocks.destroyed_msg')
|
|
|
|
redirect_to admin_domain_blocks_path, notice: I18n.t('admin.domain_blocks.destroyed_msg')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
private
|
|
|
|
private
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def set_domain_block
|
|
|
|
|
|
|
|
@domain_block = DomainBlock.find(params[:id])
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def resource_params
|
|
|
|
def resource_params
|
|
|
|
params.require(:domain_block).permit(:domain, :severity, :reject_media, :retroactive)
|
|
|
|
params.require(:domain_block).permit(:domain, :severity, :reject_media, :retroactive)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def retroactive_unblock?
|
|
|
|
def retroactive_unblock?
|
|
|
|
resource_params[:retroactive] == '1'
|
|
|
|
ActiveRecord::Type.lookup(:boolean).cast(resource_params[:retroactive])
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|