mirror of
https://github.com/internetee/registry.git
synced 2025-06-08 13:44:47 +02:00
Fix some code styling issues
This commit is contained in:
parent
42946dfa15
commit
25d78cde74
4 changed files with 23 additions and 15 deletions
|
@ -3,7 +3,7 @@
|
|||
module Admin
|
||||
class DisputesController < BaseController
|
||||
load_and_authorize_resource
|
||||
before_action :set_dispute, only: %i[show edit update destroy]
|
||||
before_action :set_dispute, only: %i[show edit update delete]
|
||||
|
||||
# GET /admin/disputes
|
||||
def index
|
||||
|
@ -12,12 +12,16 @@ module Admin
|
|||
|
||||
@q = disputes.search(params[:q])
|
||||
@disputes = @q.result.page(params[:page])
|
||||
@disputes = @disputes.per(params[:results_per_page]) if params[:results_per_page].to_i.positive?
|
||||
if params[:results_per_page].to_i.positive?
|
||||
@disputes = @disputes.per(params[:results_per_page])
|
||||
end
|
||||
|
||||
closed_disputes = Dispute.closed.order(:domain_name)
|
||||
@closed_q = closed_disputes.search(params[:closed_q])
|
||||
@closed_disputes = @closed_q.result.page(params[:closed_page])
|
||||
@closed_disputes = @closed_disputes.per(params[:results_per_page]) if params[:results_per_page].to_i.positive?
|
||||
return unless params[:results_per_page].to_i.positive?
|
||||
|
||||
@closed_disputes = @closed_disputes.per(params[:results_per_page])
|
||||
end
|
||||
|
||||
# GET /admin/disputes/1
|
||||
|
|
|
@ -32,7 +32,6 @@ class Registrant::DomainUpdateConfirmsController < RegistrantController
|
|||
elsif params[:confirmed]
|
||||
if @registrant_verification.domain_registrant_change_confirm!("email link, #{initiator}")
|
||||
if @domain.disputed?
|
||||
Rails.logger.info 'Closing domain dispute via RegistrantConfirmation'
|
||||
dispute = Dispute.active.find_by(domain_name: @domain.name)
|
||||
dispute.close
|
||||
end
|
||||
|
|
|
@ -90,7 +90,8 @@ class Dispute < ApplicationRecord
|
|||
def validate_domain_name_period_uniqueness
|
||||
return unless new_record?
|
||||
|
||||
existing_dispute = Dispute.unscoped.where(domain_name: domain_name, closed: false).where('expires_at > ?', starts_at)
|
||||
existing_dispute = Dispute.unscoped.where(domain_name: domain_name, closed: false)
|
||||
.where('expires_at > ?', starts_at)
|
||||
return unless existing_dispute.any?
|
||||
|
||||
errors.add(:base, 'Dispute already exists for this domain at given timeframe')
|
||||
|
|
|
@ -53,13 +53,13 @@ class Epp::Domain < Domain
|
|||
def epp_code_map
|
||||
{
|
||||
'2002' => [ # Command use error
|
||||
[:base, :domain_already_belongs_to_the_querying_registrar]
|
||||
%i[base domain_already_belongs_to_the_querying_registrar]
|
||||
],
|
||||
'2003' => [ # Required parameter missing
|
||||
[:registrant, :blank],
|
||||
[:registrar, :blank],
|
||||
[:base, :required_parameter_missing_reserved],
|
||||
[:base, :required_parameter_missing_disputed]
|
||||
%i[registrant blank],
|
||||
%i[registrar blank],
|
||||
%i[base required_parameter_missing_reserved],
|
||||
%i[base required_parameter_missing_disputed],
|
||||
],
|
||||
'2004' => [ # Parameter value range error
|
||||
[:dnskeys, :out_of_range,
|
||||
|
@ -86,11 +86,11 @@ class Epp::Domain < Domain
|
|||
[:puny_label, :too_long, { obj: 'name', val: name_puny }]
|
||||
],
|
||||
'2201' => [ # Authorisation error
|
||||
[:transfer_code, :wrong_pw]
|
||||
%i[transfer_code wrong_pw]
|
||||
],
|
||||
'2202' => [
|
||||
[:base, :invalid_auth_information_reserved],
|
||||
[:base, :invalid_auth_information_disputed]
|
||||
%i[base invalid_auth_information_reserved],
|
||||
%i[base invalid_auth_information_disputed],
|
||||
],
|
||||
'2302' => [ # Object exists
|
||||
[:name_dirty, :taken, { value: { obj: 'name', val: name_dirty } }],
|
||||
|
@ -481,10 +481,14 @@ class Epp::Domain < Domain
|
|||
if !same_registrant_as_current && disputed?
|
||||
disputed_pw = frame.css('disputed > pw').text
|
||||
if disputed_pw.blank?
|
||||
add_epp_error('2304', nil, nil, 'Required parameter missing; disputed pw element required for dispute domains')
|
||||
add_epp_error('2304', nil, nil, 'Required parameter missing; disputed' \
|
||||
'pw element required for dispute domains')
|
||||
else
|
||||
dispute = Dispute.active.find_by(domain_name: name, password: disputed_pw)
|
||||
add_epp_error('2202', nil, nil, 'Invalid authorization information; invalid disputed>pw value') if dispute.nil?
|
||||
if dispute.nil?
|
||||
add_epp_error('2202', nil, nil, 'Invalid authorization information; '\
|
||||
'invalid disputed>pw value')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue