From 28e8b067283dec9971a071385b2dd9879589e8d3 Mon Sep 17 00:00:00 2001 From: Alex Sherman Date: Thu, 11 Jun 2020 15:49:43 +0500 Subject: [PATCH 1/2] Fix not running whois update after contact update Closes #1604 --- app/models/contact.rb | 3 ++- config/environments/test.rb | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/models/contact.rb b/app/models/contact.rb index 2ee45e716..c5a86e89f 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -502,7 +502,8 @@ class Contact < ApplicationRecord def update_related_whois_records # not doing anything if no real changes - return if changes.slice(*(self.class.column_names - ["updated_at", "created_at", "statuses", "status_notes"])).empty? + ignored_columns = %w[updated_at created_at statuses status_notes] + return if saved_changes.slice(*(self.class.column_names - ignored_columns)).empty? names = related_domain_descriptions.keys UpdateWhoisRecordJob.enqueue(names, 'domain') if names.present? diff --git a/config/environments/test.rb b/config/environments/test.rb index 784b48f42..c55e59e31 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,6 +1,6 @@ Rails.application.configure do - $VERBOSE = nil + # $VERBOSE = nil # Settings specified here will take precedence over those in config/application.rb. # The test environment is used exclusively to run your application's From 10921ef1280f2e753f6fe9ce3676ffda9bbc0989 Mon Sep 17 00:00:00 2001 From: Alex Sherman Date: Thu, 11 Jun 2020 17:03:37 +0500 Subject: [PATCH 2/2] Add test to see if whois record updated --- test/models/contact_test.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/models/contact_test.rb b/test/models/contact_test.rb index 923a8d44e..4e500e98d 100644 --- a/test/models/contact_test.rb +++ b/test/models/contact_test.rb @@ -248,6 +248,15 @@ class ContactTest < ActiveSupport::TestCase assert_equal %w[ok], contact.statuses end + def test_whois_gets_updated_after_contact_save + @contact.name = 'SomeReallyWeirdRandomTestName' + domain = @contact.registrant_domains.first + + @contact.save! + + assert_equal domain.whois_record.try(:json).try(:[], 'registrant'), @contact.name + end + private def make_contact_free_of_domains_where_it_acts_as_a_registrant(contact)