mirror of
https://github.com/internetee/registry.git
synced 2025-06-07 21:25:39 +02:00
Fix CC issues
This commit is contained in:
parent
8755fbdbf4
commit
a495c2ab1c
2 changed files with 13 additions and 11 deletions
|
@ -21,34 +21,37 @@ module Repp
|
||||||
end
|
end
|
||||||
|
|
||||||
def epp_errors
|
def epp_errors
|
||||||
@errors ||= []
|
@epp_errors ||= []
|
||||||
end
|
end
|
||||||
|
|
||||||
def handle_errors(obj = nil, update: false)
|
def handle_errors(obj = nil, update: false)
|
||||||
@errors ||= []
|
@epp_errors ||= []
|
||||||
|
|
||||||
if obj
|
if obj
|
||||||
obj.construct_epp_errors
|
obj.construct_epp_errors
|
||||||
@errors += obj.errors[:epp_errors]
|
@epp_errors += obj.errors[:epp_errors]
|
||||||
end
|
end
|
||||||
|
|
||||||
if update
|
if update
|
||||||
@errors.each_with_index do |errors, index|
|
@epp_errors.each_with_index do |errors, index|
|
||||||
next unless errors[:code] == '2304' && errors[:value].present? &&
|
next unless errors[:code] == '2304' && errors[:value].present? &&
|
||||||
errors[:value][:val] == DomainStatus::SERVER_DELETE_PROHIBITED &&
|
errors[:value][:val] == DomainStatus::SERVER_DELETE_PROHIBITED &&
|
||||||
errors[:value][:obj] == 'status'
|
errors[:value][:obj] == 'status'
|
||||||
|
|
||||||
@errors[index][:value][:val] = DomainStatus::PENDING_UPDATE
|
@epp_errors[index][:value][:val] = DomainStatus::PENDING_UPDATE
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@errors.uniq!
|
@epp_errors.uniq!
|
||||||
|
|
||||||
render_epp_error
|
render_epp_error
|
||||||
end
|
end
|
||||||
|
|
||||||
def render_epp_error
|
def render_epp_error
|
||||||
render(json: { code: @errors[0][:code], message: @errors[0][:msg] }, status: :bad_request)
|
render(
|
||||||
|
json: { code: @epp_errors[0][:code], message: @epp_errors[0][:msg] },
|
||||||
|
status: :bad_request
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
def ip_whitelisted?
|
def ip_whitelisted?
|
||||||
|
|
|
@ -6,9 +6,8 @@ module Repp
|
||||||
## GET /repp/v1/contacts
|
## GET /repp/v1/contacts
|
||||||
def index
|
def index
|
||||||
record_count = current_user.registrar.contacts.count
|
record_count = current_user.registrar.contacts.count
|
||||||
show_addresses = Contact.address_processing? && params[:details] == 'true'
|
|
||||||
contacts = showable_contacts(params[:details], params[:limit] || 200,
|
contacts = showable_contacts(params[:details], params[:limit] || 200,
|
||||||
params[:offset] || 0, show_addresses)
|
params[:offset] || 0)
|
||||||
|
|
||||||
render(json: { contacts: contacts, total_number_of_records: record_count }, status: :ok)
|
render(json: { contacts: contacts, total_number_of_records: record_count }, status: :ok)
|
||||||
end
|
end
|
||||||
|
@ -65,9 +64,9 @@ module Repp
|
||||||
message: opt_addr? ? I18n.t('epp.contacts.completed_without_address') : nil }
|
message: opt_addr? ? I18n.t('epp.contacts.completed_without_address') : nil }
|
||||||
end
|
end
|
||||||
|
|
||||||
def showable_contacts(details, limit, offset, addresses)
|
def showable_contacts(details, limit, offset)
|
||||||
contacts = current_user.registrar.contacts.limit(limit).offset(offset)
|
contacts = current_user.registrar.contacts.limit(limit).offset(offset)
|
||||||
unless addresses
|
unless Contact.address_processing? && params[:details] == 'true'
|
||||||
contacts = contacts.select(Contact.attribute_names - Contact.address_attribute_names)
|
contacts = contacts.select(Contact.attribute_names - Contact.address_attribute_names)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue