diff --git a/app/controllers/epp/domains_controller.rb b/app/controllers/epp/domains_controller.rb index 63343feb3..66fff5211 100644 --- a/app/controllers/epp/domains_controller.rb +++ b/app/controllers/epp/domains_controller.rb @@ -156,7 +156,7 @@ class Epp::DomainsController < EppController def find_domain domain_name = params[:parsed_frame].css('name').text.strip.downcase - @domain = Epp::Domain.where(name: domain_name).first + @domain = Epp::Domain.where(name: domain_name).includes(owner_contact: :registrar).first unless @domain epp_errors << { diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index 1747e4d08..f7c9d8eb0 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -68,11 +68,8 @@ class Epp::Domain < Domain end def attach_default_contacts - # for bullet, owner contact validates registrar and triggers bullet - owner_contact_included = Contact.where(id: owner_contact.id).includes(:registrar).first - - tech_contacts << owner_contact_included if tech_contacts.blank? - admin_contacts << owner_contact_included if admin_contacts.blank? && owner_contact.priv? + tech_contacts << owner_contact if tech_contacts.blank? + admin_contacts << owner_contact if admin_contacts.blank? && owner_contact.priv? end # rubocop: disable Metrics/PerceivedComplexity diff --git a/config/environments/test.rb b/config/environments/test.rb index 8c3c920c5..1a43b07c1 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -50,5 +50,8 @@ Rails.application.configure do Bullet.bullet_logger = true Bullet.raise = true # raise an error if n+1 query occurs Bullet.unused_eager_loading_enable = false + + # Currenty hard to fix, it is triggered by Epp::Domain.new_from_epp for create request + Bullet.add_whitelist type: :n_plus_one_query, class_name: 'Contact', association: :registrar end end