mirror of
https://github.com/internetee/registry.git
synced 2025-07-23 11:16:00 +02:00
Fix some CC issues
This commit is contained in:
parent
0d2cb6b7f2
commit
7c35083a8b
8 changed files with 48 additions and 30 deletions
|
@ -10,7 +10,7 @@ module Repp
|
|||
param :domain_name, String, required: true, desc: 'Domain name'
|
||||
param :status, String, required: true, desc: 'Status to be removed'
|
||||
def destroy
|
||||
return editing_failed unless @domain.statuses.include?(params[:id])
|
||||
return editing_failed unless domain_with_status?(params[:id])
|
||||
|
||||
@domain.statuses = @domain.statuses.delete(params[:id])
|
||||
if @domain.save
|
||||
|
@ -25,18 +25,22 @@ module Repp
|
|||
param :domain_name, String, required: true, desc: 'Domain name'
|
||||
param :status, String, required: true, desc: 'Status to be added'
|
||||
def update
|
||||
return editing_failed if @domain.statuses.include?(params[:id])
|
||||
return editing_failed if domain_with_status?(params[:id])
|
||||
|
||||
@domain.statuses = @domain.statuses << params[:id]
|
||||
# rubocop:disable Style/AndOr
|
||||
handle_errors(@domain) and return unless @domain.save
|
||||
# rubocop:enable Style/AndOr
|
||||
|
||||
render_success(data: { domain: @domain.name, status: params[:id] })
|
||||
@domain.statuses << params[:id]
|
||||
if @domain.save
|
||||
render_success(data: { domain: @domain.name, status: params[:id] })
|
||||
else
|
||||
handle_errors(@domain)
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def domain_with_status?
|
||||
@domain.statuses.include?(params[:id])
|
||||
end
|
||||
|
||||
def verify_status
|
||||
allowed_statuses = [DomainStatus::CLIENT_HOLD].freeze
|
||||
stat = params[:id]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue