Merge branch 'master' of github.com:internetee/registry

Conflicts:
	app/models/domain.rb
	app/models/epp/epp_domain.rb
	config/locales/en.yml
	spec/epp/domain_spec.rb
This commit is contained in:
Martin Lensment 2014-10-13 10:37:26 +03:00
commit ee2d93128c
50 changed files with 528 additions and 201 deletions

View file

@ -8,12 +8,12 @@ module Epp::DomainsHelper
if @domain.errors.any?
handle_errors(@domain)
raise ActiveRecord::Rollback and return
fail ActiveRecord::Rollback and return
end
unless @domain.save
handle_errors(@domain)
raise ActiveRecord::Rollback and return
fail ActiveRecord::Rollback and return
end
render '/epp/domains/create'
@ -44,6 +44,7 @@ module Epp::DomainsHelper
render '/epp/domains/info'
end
# rubocop:disable Metrics/CyclomaticComplexity
def update_domain
Epp::EppDomain.transaction do
@domain = find_domain
@ -58,17 +59,18 @@ module Epp::DomainsHelper
if @domain.errors.any?
handle_errors(@domain)
raise ActiveRecord::Rollback and return
fail ActiveRecord::Rollback and return
end
unless @domain.save
handle_errors(@domain)
raise ActiveRecord::Rollback and return
fail ActiveRecord::Rollback and return
end
render '/epp/domains/success'
end
end
# rubocop:enable Metrics/CyclomaticComplexity
def transfer_domain
@domain = find_domain(secure: false)
@ -79,6 +81,7 @@ module Epp::DomainsHelper
render '/epp/domains/transfer'
end
# rubocop:disable Metrics/CyclomaticComplexity
def delete_domain
@domain = find_domain
@ -88,6 +91,7 @@ module Epp::DomainsHelper
render '/epp/domains/success'
end
# rubocop:enbale Metrics/CyclomaticComplexity
### HELPER METHODS ###
@ -166,12 +170,20 @@ module Epp::DomainsHelper
domain = Epp::EppDomain.find_by(name: @ph[:name])
unless domain
epp_errors << { code: '2303', msg: I18n.t('errors.messages.epp_domain_not_found'), value: { obj: 'name', val: @ph[:name] } }
epp_errors << {
code: '2303',
msg: I18n.t('errors.messages.epp_domain_not_found'),
value: { obj: 'name', val: @ph[:name] }
}
return nil
end
if domain.registrar != current_epp_user.registrar && secure[:secure] == true
epp_errors << { code: '2302', msg: I18n.t('errors.messages.domain_exists_but_belongs_to_other_registrar'), value: { obj: 'name', val: @ph[:name] } }
epp_errors << {
code: '2302',
msg: I18n.t('errors.messages.domain_exists_but_belongs_to_other_registrar'),
value: { obj: 'name', val: @ph[:name] }
}
return nil
end