Fixed codeclimate issues

This commit is contained in:
Sergei Tsoganov 2023-04-06 21:53:25 +03:00
parent cc4d4d0e1f
commit 7f0787b27f
2 changed files with 10 additions and 16 deletions

View file

@ -5,6 +5,7 @@ module Admin
before_action :set_domain, only: %i[show edit update download keep] before_action :set_domain, only: %i[show edit update download keep]
authorize_resource authorize_resource
# rubocop:disable Metrics/MethodLength
def index def index
params[:q] ||= {} params[:q] ||= {}
domains = Domain.includes(:registrar, :registrant).joins(:registrar, :registrant) domains = Domain.includes(:registrar, :registrant).joins(:registrar, :registrant)
@ -22,16 +23,6 @@ module Admin
render_by_format('admin/domains/index', 'domains') render_by_format('admin/domains/index', 'domains')
end end
def show
# Validation is needed to warn users
@domain.validate
end
def edit
build_associations
end
# rubocop:disable Metrics/MethodLength
def update def update
rollback_history = @domain.json_statuses_history&.[]('admin_store_statuses_history') rollback_history = @domain.json_statuses_history&.[]('admin_store_statuses_history')
dp = ignore_empty_statuses dp = ignore_empty_statuses
@ -51,6 +42,15 @@ module Admin
end end
# rubocop:enable Metrics/MethodLength # rubocop:enable Metrics/MethodLength
def show
# Validation is needed to warn users
@domain.validate
end
def edit
build_associations
end
def versions def versions
@domain = Domain.where(id: params[:domain_id]).includes({ versions: :item }).first @domain = Domain.where(id: params[:domain_id]).includes({ versions: :item }).first
@versions = @domain.versions @versions = @domain.versions

View file

@ -665,12 +665,6 @@ class Domain < ApplicationRecord
self.outzone_at = Time.current self.outzone_at = Time.current
end end
def manage_automatic_statuses
check_nameservers
check_statuses
check_pending_delete
end
def manage_automatic_statuses def manage_automatic_statuses
unless self.class.nameserver_required? unless self.class.nameserver_required?
deactivate if nameservers.reject(&:marked_for_destruction?).empty? deactivate if nameservers.reject(&:marked_for_destruction?).empty?