From ecb23b41190a5df1d3c255e972c780c085eb07b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergei=20Ts=C3=B5ganov?= Date: Thu, 14 Apr 2022 14:07:37 +0300 Subject: [PATCH] Fixed message format for epp 2005 error --- app/interactions/actions/contact_create.rb | 4 +++- app/interactions/actions/contact_update.rb | 6 ++++-- app/interactions/actions/domain_update.rb | 6 ++++-- config/locales/en.yml | 2 +- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/app/interactions/actions/contact_create.rb b/app/interactions/actions/contact_create.rb index 84ed10caff..f0d11896b0 100644 --- a/app/interactions/actions/contact_create.rb +++ b/app/interactions/actions/contact_create.rb @@ -24,7 +24,9 @@ def maybe_change_email next if result - contact.add_epp_error('2005', nil, "email didn't pass validation", I18n.t(:parameter_value_syntax_error)) + err_text = "email '#{contact.email}' didn't pass validation" + contact.add_epp_error('2005', nil, nil, + "#{I18n.t(:parameter_value_syntax_error)} #{err_text}") @error = true return end diff --git a/app/interactions/actions/contact_update.rb b/app/interactions/actions/contact_update.rb index 685f1474c5..abf55e96a9 100644 --- a/app/interactions/actions/contact_update.rb +++ b/app/interactions/actions/contact_update.rb @@ -23,11 +23,13 @@ def call def maybe_change_email return if Rails.env.test? - [:regex, :mx].each do |m| + %i[regex mx].each do |m| result = Actions::SimpleMailValidator.run(email: @new_attributes[:email], level: m) next if result - contact.add_epp_error('2005', nil, "email didn't pass validation", I18n.t(:parameter_value_syntax_error)) + err_text = "email '#{new_attributes[:email]}' didn't pass validation" + contact.add_epp_error('2005', nil, nil, + "#{I18n.t(:parameter_value_syntax_error)} #{err_text}") @error = true return end diff --git a/app/interactions/actions/domain_update.rb b/app/interactions/actions/domain_update.rb index c610e01177..7d556b2e8e 100644 --- a/app/interactions/actions/domain_update.rb +++ b/app/interactions/actions/domain_update.rb @@ -136,11 +136,13 @@ def start_validate_email(props) def validate_email(email) return true if Rails.env.test? - [:regex, :mx].each do |m| + %i[regex mx].each do |m| result = Actions::SimpleMailValidator.run(email: email, level: m) next if result - domain.add_epp_error('2005', nil, "#{email} didn't pass validation", I18n.t(:parameter_value_syntax_error)) + err_text = "email #{email} didn't pass validation" + domain.add_epp_error('2005', nil, nil, + "#{I18n.t(:parameter_value_syntax_error)} #{err_text}") @error = true return end diff --git a/config/locales/en.yml b/config/locales/en.yml index 2f7e8a0aaa..28d2d0281f 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -371,7 +371,7 @@ en: sim_error: 'SIM application error' internal_error: 'Internal error' client_side_status_editing_error: 'Parameter value policy error. Client-side object status management not supported' - parameter_value_syntax_error: 'Parameter value syntax error: ' + parameter_value_syntax_error: 'Parameter value syntax error:' # DEPP activemodel: