mirror of
https://github.com/internetee/registry.git
synced 2025-07-25 03:58:27 +02:00
Fix some more CC issues
This commit is contained in:
parent
cdf28befca
commit
aac74e26f1
4 changed files with 17 additions and 17 deletions
|
@ -4,7 +4,6 @@ module Epp
|
|||
class ContactsController < BaseController
|
||||
before_action :find_contact, only: [:info, :update, :delete]
|
||||
before_action :find_password, only: [:info, :update, :delete]
|
||||
helper_method :address_processing?
|
||||
|
||||
def info
|
||||
authorize! :info, @contact, @password
|
||||
|
@ -68,11 +67,13 @@ module Epp
|
|||
private
|
||||
|
||||
def opt_addr?
|
||||
!address_processing? && address_given?
|
||||
!Contact.address_processing? && address_given?
|
||||
end
|
||||
|
||||
def action_call_response(action:)
|
||||
# rubocop:disable Style/AndOr
|
||||
(handle_errors(@contact) and return) unless action.call
|
||||
# rubocop:enable Style/AndOr
|
||||
|
||||
if opt_addr?
|
||||
@response_code = 1100
|
||||
|
@ -123,8 +124,7 @@ module Epp
|
|||
'postalInfo > addr > cc',
|
||||
]
|
||||
|
||||
required_attributes.concat(address_attributes) if address_processing?
|
||||
|
||||
required_attributes.concat(address_attributes) if Contact.address_processing?
|
||||
requires(*required_attributes)
|
||||
ident = params[:parsed_frame].css('ident')
|
||||
|
||||
|
@ -200,9 +200,5 @@ module Epp
|
|||
def address_given?
|
||||
params[:parsed_frame].css('postalInfo addr').size != 0
|
||||
end
|
||||
|
||||
def address_processing?
|
||||
Contact.address_processing?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -27,12 +27,7 @@ module Actions
|
|||
|
||||
def validate_ident
|
||||
validate_ident_integrity
|
||||
|
||||
if ident.present? && ident[:ident_type] != 'birthday' && ident[:ident_country_code].blank?
|
||||
contact.add_epp_error('2003', nil, 'ident_country_code',
|
||||
I18n.t('errors.messages.required_ident_attribute_missing'))
|
||||
@error = true
|
||||
end
|
||||
validate_ident_birthday
|
||||
|
||||
identifier = ::Contact::Ident.new(code: ident[:ident], type: ident[:ident_type],
|
||||
country_code: ident[:ident_country_code])
|
||||
|
@ -54,6 +49,15 @@ module Actions
|
|||
end
|
||||
end
|
||||
|
||||
def validate_ident_birthday
|
||||
return if ident.blank?
|
||||
return unless ident[:ident_type] != 'birthday' && ident[:ident_country_code].blank?
|
||||
|
||||
contact.add_epp_error('2003', nil, 'ident_country_code',
|
||||
I18n.t('errors.messages.required_ident_attribute_missing'))
|
||||
@error = true
|
||||
end
|
||||
|
||||
def maybe_attach_legal_doc
|
||||
return unless legal_document
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ xml.epp_head do
|
|||
if can? :view_full_info, @contact, @password
|
||||
xml.tag!('contact:org', @contact.org_name) if @contact.org_name.present?
|
||||
|
||||
if address_processing?
|
||||
if Contact.address_processing?
|
||||
xml.tag!('contact:addr') do
|
||||
xml.tag!('contact:street', @contact.street)
|
||||
xml.tag!('contact:city', @contact.city)
|
||||
|
@ -31,7 +31,7 @@ xml.epp_head do
|
|||
else
|
||||
xml.tag!('contact:org', 'No access')
|
||||
|
||||
if address_processing?
|
||||
if Contact.address_processing?
|
||||
xml.tag!('contact:addr') do
|
||||
xml.tag!('contact:street', 'No access')
|
||||
xml.tag!('contact:city', 'No access')
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
.col-md-8
|
||||
= render 'registrar/contacts/form/general', f: f
|
||||
|
||||
- if address_processing?
|
||||
- if Contact.address_processing?
|
||||
.row
|
||||
.col-md-8
|
||||
= render 'registrar/contacts/form/address', f: f
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue