Allow removing contacts one by one #2596

This commit is contained in:
Martin Lensment 2015-05-28 12:07:18 +03:00
parent bd18cc0a85
commit 573349d0b6

View file

@ -192,10 +192,10 @@ module Depp
end
def construct_edit_hash(domain_params, old_domain_params)
contacts = create_contacts_hash(domain_params) - create_contacts_hash(old_domain_params)
contacts = array_difference(create_contacts_hash(domain_params), create_contacts_hash(old_domain_params))
add_anon = contacts
contacts = create_contacts_hash(old_domain_params) - create_contacts_hash(domain_params)
contacts = array_difference(create_contacts_hash(old_domain_params), create_contacts_hash(domain_params))
rem_anon = contacts
if domain_params[:registrant] != old_domain_params[:registrant]
@ -284,6 +284,15 @@ module Depp
pubKey: { value: key_data_params['public_key'] }
}
end
def array_difference(x, y)
ret = x.dup
y.each do |element|
index = ret.index(element)
ret.delete_at(index) if index
end
ret
end
end
end
end