Merge branch 'master' into api-log

Conflicts:
	app/helpers/epp/contacts_helper.rb
This commit is contained in:
Martin Lensment 2015-01-13 16:29:37 +02:00
commit fcc5ae1f23
13 changed files with 204 additions and 148 deletions

View file

@ -37,11 +37,13 @@ module Epp::ContactsHelper
end
def info_contact
handle_errors(@contact) and return unless @contact
handle_errors(@contact) and return unless rights?
handle_errors(@contact) and return unless @contact && rights?
# handle_errors(@contact) and return unless rights?
@disclosure = ContactDisclosure.default_values.merge(@contact.disclosure.try(:as_hash) || {})
@disclosure_policy = @contact.disclosure.try(:attributes_with_flag)
@owner = owner?(false)
# need to reload contact eagerly
@contact = find_contact('with eager load') if @owner # for clarity, could just be true
render_epp_response 'epp/contacts/info'
end
@ -109,8 +111,12 @@ module Epp::ContactsHelper
## SHARED
def find_contact
contact = Contact.find_by(code: @ph[:id])
def find_contact(eager_load = nil)
if eager_load
contact = Contact.includes(address: :country).find_by(code: @ph[:id])
else
contact = Contact.find_by(code: @ph[:id])
end
unless contact
epp_errors << { code: '2303',
msg: t('errors.messages.epp_obj_does_not_exist'),