mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 17:59:47 +02:00
Domain contacts removing in domain update
This commit is contained in:
parent
fa28f09ff0
commit
3eb1925a32
2 changed files with 25 additions and 6 deletions
|
@ -50,11 +50,11 @@ class Epp::DomainsController < EppController
|
||||||
# @domain.parse_and_attach_ds_data(params[:parsed_frame].css('extension add'))
|
# @domain.parse_and_attach_ds_data(params[:parsed_frame].css('extension add'))
|
||||||
# @domain.parse_and_update_domain_dependencies(params[:parsed_frame].css('chg'))
|
# @domain.parse_and_update_domain_dependencies(params[:parsed_frame].css('chg'))
|
||||||
# @domain.attach_legal_document(Epp::EppDomain.parse_legal_document_from_frame(params[:parsed_frame]))
|
# @domain.attach_legal_document(Epp::EppDomain.parse_legal_document_from_frame(params[:parsed_frame]))
|
||||||
|
# binding.pry
|
||||||
if @domain.update(params[:parsed_frame], current_user)
|
if @domain.update(params[:parsed_frame], current_user)
|
||||||
handle_errors(@domain)
|
|
||||||
else
|
|
||||||
render_epp_response '/epp/domains/success'
|
render_epp_response '/epp/domains/success'
|
||||||
|
else
|
||||||
|
handle_errors(@domain)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ class Epp::EppDomain < Domain
|
||||||
at[:period_unit] = Epp::EppDomain.parse_period_unit_from_frame(frame) || 'y'
|
at[:period_unit] = Epp::EppDomain.parse_period_unit_from_frame(frame) || 'y'
|
||||||
|
|
||||||
at[:nameservers_attributes] = nameservers_attrs(frame, action)
|
at[:nameservers_attributes] = nameservers_attrs(frame, action)
|
||||||
at[:domain_contacts_attributes] = domain_contacts_from(frame)
|
at[:domain_contacts_attributes] = domain_contacts_attrs(frame, action)
|
||||||
at[:dnskeys_attributes] = dnskeys_from(frame.css('extension create'))
|
at[:dnskeys_attributes] = dnskeys_from(frame.css('extension create'))
|
||||||
at[:legal_documents_attributes] = legal_document_from(frame)
|
at[:legal_documents_attributes] = legal_document_from(frame)
|
||||||
|
|
||||||
|
@ -116,7 +116,26 @@ class Epp::EppDomain < Domain
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def domain_contacts_from(frame)
|
def domain_contacts_attrs(frame, action)
|
||||||
|
contact_list = parse_contact_list(frame)
|
||||||
|
|
||||||
|
if action == 'rem'
|
||||||
|
to_destroy = []
|
||||||
|
contact_list.each do |dc|
|
||||||
|
domain_contact_id = domain_contacts.find_by(contact_id: dc[:contact_id]).id
|
||||||
|
to_destroy << {
|
||||||
|
id: domain_contact_id,
|
||||||
|
_destroy: 1
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
return to_destroy
|
||||||
|
else
|
||||||
|
return contact_list
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def parse_contact_list(frame)
|
||||||
res = []
|
res = []
|
||||||
frame.css('contact').each do |x|
|
frame.css('contact').each do |x|
|
||||||
c = Contact.find_by(code: x.text).try(:id)
|
c = Contact.find_by(code: x.text).try(:id)
|
||||||
|
@ -202,7 +221,7 @@ class Epp::EppDomain < Domain
|
||||||
|
|
||||||
at_add = attrs_from(frame.css('add'), current_user)
|
at_add = attrs_from(frame.css('add'), current_user)
|
||||||
at[:nameservers_attributes] += at_add[:nameservers_attributes]
|
at[:nameservers_attributes] += at_add[:nameservers_attributes]
|
||||||
# at[:domain_contacts_attributes] += at_add[:domain_contacts_attributes]
|
at[:domain_contacts_attributes] += at_add[:domain_contacts_attributes]
|
||||||
|
|
||||||
super(at)
|
super(at)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue