mirror of
https://github.com/internetee/registry.git
synced 2025-08-02 16:02:03 +02:00
Nameserver removing with domain update request
This commit is contained in:
parent
c0d25ccedf
commit
87cc7799be
9 changed files with 87 additions and 16 deletions
|
@ -39,6 +39,7 @@ module Epp::DomainsHelper
|
|||
|
||||
handle_errors(@domain) and return unless @domain
|
||||
handle_errors(@domain) and return unless @domain.attach_objects(@ph, parsed_frame.css('add'))
|
||||
handle_errors(@domain) and return unless @domain.detach_objects(@ph, parsed_frame.css('rem'))
|
||||
handle_errors(@domain) and return unless @domain.save
|
||||
|
||||
render '/epp/domains/success'
|
||||
|
|
|
@ -49,7 +49,7 @@ class Domain < ActiveRecord::Base
|
|||
write_attribute(:name_dirty, value)
|
||||
end
|
||||
|
||||
### CREATE ###
|
||||
### CREATE & UPDATE ###
|
||||
|
||||
def attach_objects(ph, parsed_frame)
|
||||
attach_owner_contact(ph[:registrant]) if ph[:registrant]
|
||||
|
@ -60,6 +60,10 @@ class Domain < ActiveRecord::Base
|
|||
errors.empty?
|
||||
end
|
||||
|
||||
def detach_objects(ph, parsed_frame)
|
||||
detach_nameservers(self.class.parse_nameservers_from_frame(parsed_frame))
|
||||
end
|
||||
|
||||
def attach_owner_contact(code)
|
||||
self.owner_contact = Contact.find_by(code: code)
|
||||
|
||||
|
@ -116,6 +120,15 @@ class Domain < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
def detach_nameservers(ns_list)
|
||||
to_delete = []
|
||||
ns_list.each do |ns_attrs|
|
||||
to_delete << self.nameservers.where(ns_attrs)
|
||||
end
|
||||
|
||||
self.nameservers.delete(to_delete)
|
||||
end
|
||||
|
||||
### RENEW ###
|
||||
|
||||
def renew(cur_exp_date, period, unit='y')
|
||||
|
@ -255,7 +268,6 @@ class Domain < ActiveRecord::Base
|
|||
description: x.text
|
||||
}
|
||||
end
|
||||
|
||||
res
|
||||
end
|
||||
|
||||
|
@ -275,7 +287,7 @@ class Domain < ActiveRecord::Base
|
|||
end
|
||||
|
||||
if Domain.find_by(name: x)
|
||||
res << {name: x, avail: 0, reason: 'in use'} #confirm reason with current API
|
||||
res << {name: x, avail: 0, reason: 'in use'}
|
||||
else
|
||||
res << {name: x, avail: 1}
|
||||
end
|
||||
|
|
|
@ -13,10 +13,6 @@ class DomainStatus < ActiveRecord::Base
|
|||
|
||||
validates :setting, uniqueness: { scope: :domain_id }
|
||||
|
||||
def setting_uniqueness
|
||||
|
||||
end
|
||||
|
||||
def epp_code_map
|
||||
{
|
||||
'2302' => [[:setting, :taken]]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue