ruby syntaxt upadtes #2557

This commit is contained in:
Priit Tark 2015-06-16 22:35:40 +03:00
parent 1b66e74108
commit 9c43e8e302
5 changed files with 13 additions and 15 deletions

View file

@ -318,6 +318,7 @@ class Domain < ActiveRecord::Base
pending_json[:domain] = changes_cache pending_json[:domain] = changes_cache
end end
# rubocop: disable Metrics/CyclomaticComplexity
def registrant_update_confirmable?(token) def registrant_update_confirmable?(token)
return true if Rails.env.development? return true if Rails.env.development?
return false unless pending_update? return false unless pending_update?
@ -337,6 +338,7 @@ class Domain < ActiveRecord::Base
return false if registrant_verification_token != token return false if registrant_verification_token != token
true true
end end
# rubocop: enable Metrics/CyclomaticComplexity
def force_deletable? def force_deletable?
!statuses.include?(DomainStatus::FORCE_DELETE) !statuses.include?(DomainStatus::FORCE_DELETE)
@ -362,7 +364,7 @@ class Domain < ActiveRecord::Base
self.epp_pending_delete = true # for epp self.epp_pending_delete = true # for epp
return true unless registrant_verification_asked? return true unless registrant_verification_asked?
statuses = [DomainStatus::PENDING_DELETE] self.statuses = [DomainStatus::PENDING_DELETE]
save(validate: false) # should check if this did succeed save(validate: false) # should check if this did succeed
DomainMailer.pending_deleted(self).deliver_now DomainMailer.pending_deleted(self).deliver_now

View file

@ -369,7 +369,9 @@ class Epp::Domain < Domain
at[:admin_domain_contacts_attributes] += at_add[:admin_domain_contacts_attributes] at[:admin_domain_contacts_attributes] += at_add[:admin_domain_contacts_attributes]
at[:tech_domain_contacts_attributes] += at_add[:tech_domain_contacts_attributes] at[:tech_domain_contacts_attributes] += at_add[:tech_domain_contacts_attributes]
at[:dnskeys_attributes] += at_add[:dnskeys_attributes] at[:dnskeys_attributes] += at_add[:dnskeys_attributes]
at[:statuses] = statuses - domain_statuses_attrs(frame.css('rem'), 'rem') + domain_statuses_attrs(frame.css('add'), 'add') at[:statuses] =
statuses - domain_statuses_attrs(frame.css('rem'), 'rem') + domain_statuses_attrs(frame.css('add'), 'add')
# at[:statuses] += at_add[:domain_statuses_attributes] # at[:statuses] += at_add[:domain_statuses_attributes]
if verify && frame.css('registrant').present? && frame.css('registrant').attr('verified').to_s.downcase != 'yes' if verify && frame.css('registrant').present? && frame.css('registrant').attr('verified').to_s.downcase != 'yes'
@ -385,9 +387,7 @@ class Epp::Domain < Domain
frame = Nokogiri::XML(pending_json['frame']) frame = Nokogiri::XML(pending_json['frame'])
statuses.delete(DomainStatus::PENDING_UPDATE) statuses.delete(DomainStatus::PENDING_UPDATE)
if update(frame, user, false) clean_pendings! if update(frame, user, false)
clean_pendings!
end
end end
def attach_legal_document(legal_document_data) def attach_legal_document(legal_document_data)

View file

@ -17,16 +17,12 @@ class RegistrantVerification < ActiveRecord::Base
def domain_registrant_change_confirm! def domain_registrant_change_confirm!
self.action_type = DOMAIN_REGISTRANT_CHANGE self.action_type = DOMAIN_REGISTRANT_CHANGE
self.action = CONFIRMED self.action = CONFIRMED
if save DomainConfirmJob.enqueue domain.id, CONFIRMED if save
DomainConfirmJob.enqueue domain.id, CONFIRMED
end
end end
def domain_registrant_change_reject! def domain_registrant_change_reject!
self.action_type = DOMAIN_REGISTRANT_CHANGE self.action_type = DOMAIN_REGISTRANT_CHANGE
self.action = REJECTED self.action = REJECTED
if save DomainConfirmJob.enqueue domain.id, REJECTED if save
DomainConfirmJob.enqueue domain.id, REJECTED
end
end end
end end

View file

@ -2,7 +2,7 @@ class DeviseCustomFailure < Devise::FailureApp
def redirect_url def redirect_url
return registrant_login_url if request.original_fullpath.to_s.match(/^\/registrant/) return registrant_login_url if request.original_fullpath.to_s.match(/^\/registrant/)
return registrar_login_url if request.original_fullpath.to_s.match(/^\/registrar/) return registrar_login_url if request.original_fullpath.to_s.match(/^\/registrar/)
return '/admin' if request.original_fullpath.to_s.match(/^\/admin\/que/) return '/admin' if request.original_fullpath.to_s.match(%r{^\/admin\/que})
return admin_login_url if request.original_fullpath.to_s.match(/^\/admin/) return admin_login_url if request.original_fullpath.to_s.match(/^\/admin/)
root_url root_url
end end

View file

@ -235,6 +235,7 @@ namespace :import do
legacy_contact_id legacy_contact_id
) )
# rubocop: disable Lint/UselessAssignment
domain_status_columns = %w( domain_status_columns = %w(
description description
value value
@ -242,6 +243,7 @@ namespace :import do
updator_str updator_str
legacy_domain_id legacy_domain_id
) )
# rubocop: enable Lint/UselessAssignment
nameserver_columns = %w( nameserver_columns = %w(
hostname hostname
@ -292,9 +294,7 @@ namespace :import do
end end
# OK status is default # OK status is default
if ok domain_statuses << DomainStatus::OK if ok
domain_statuses << DomainStatus::OK
end
domains << [ domains << [
x.object_registry.name.try(:strip), x.object_registry.name.try(:strip),