mirror of
https://github.com/internetee/registry.git
synced 2025-06-12 23:54:44 +02:00
convert if to return unless
This commit is contained in:
parent
8b7f4b2558
commit
fa016aa761
1 changed files with 24 additions and 24 deletions
|
@ -53,33 +53,33 @@ module Actions
|
||||||
end
|
end
|
||||||
|
|
||||||
def maybe_update_ident
|
def maybe_update_ident
|
||||||
if ident[:ident]
|
return unless ident[:ident]
|
||||||
if contact.identifier.valid?
|
|
||||||
submitted_ident = ::Contact::Ident.new(code: ident[:ident],
|
|
||||||
type: ident[:ident_type],
|
|
||||||
country_code: ident[:ident_country_code])
|
|
||||||
|
|
||||||
if submitted_ident != contact.identifier
|
if contact.identifier.valid?
|
||||||
contact.add_epp_error('2308', nil, nil, I18n.t('epp.contacts.errors.valid_ident'))
|
submitted_ident = ::Contact::Ident.new(code: ident[:ident],
|
||||||
@error = true
|
type: ident[:ident_type],
|
||||||
end
|
country_code: ident[:ident_country_code])
|
||||||
else
|
|
||||||
ident_update_attempt = ident[:ident] != contact.ident
|
|
||||||
|
|
||||||
if ident_update_attempt
|
if submitted_ident != contact.identifier
|
||||||
contact.add_epp_error('2308', nil, nil, I18n.t('epp.contacts.errors.ident_update'))
|
contact.add_epp_error('2308', nil, nil, I18n.t('epp.contacts.errors.valid_ident'))
|
||||||
@error = true
|
@error = true
|
||||||
end
|
|
||||||
|
|
||||||
identifier = ::Contact::Ident.new(code: ident[:ident],
|
|
||||||
type: ident[:ident_type],
|
|
||||||
country_code: ident[:ident_country_code])
|
|
||||||
|
|
||||||
identifier.validate
|
|
||||||
|
|
||||||
contact.identifier = identifier
|
|
||||||
contact.ident_updated_at ||= Time.zone.now
|
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
ident_update_attempt = ident[:ident] != contact.ident
|
||||||
|
|
||||||
|
if ident_update_attempt
|
||||||
|
contact.add_epp_error('2308', nil, nil, I18n.t('epp.contacts.errors.ident_update'))
|
||||||
|
@error = true
|
||||||
|
end
|
||||||
|
|
||||||
|
identifier = ::Contact::Ident.new(code: ident[:ident],
|
||||||
|
type: ident[:ident_type],
|
||||||
|
country_code: ident[:ident_country_code])
|
||||||
|
|
||||||
|
identifier.validate
|
||||||
|
|
||||||
|
contact.identifier = identifier
|
||||||
|
contact.ident_updated_at ||= Time.zone.now
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue