diff --git a/app/models/concerns/contact/archivable.rb b/app/models/concerns/contact/archivable.rb index c2a8ca103..36146d5b0 100644 --- a/app/models/concerns/contact/archivable.rb +++ b/app/models/concerns/contact/archivable.rb @@ -20,6 +20,7 @@ module Concerns def archive raise 'Contact cannot be archived' unless archivable? + destroy! end @@ -35,4 +36,4 @@ module Concerns end end end -end \ No newline at end of file +end diff --git a/app/models/contact.rb b/app/models/contact.rb index 7e9aa75c0..03aa902b8 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -240,8 +240,6 @@ class Contact < ApplicationRecord contacts.id)') end - private - def registrant_user_company_contacts(registrant_user) ident = registrant_user.companies.collect(&:registration_number) diff --git a/app/models/inactive_contacts.rb b/app/models/inactive_contacts.rb index a1ccda205..a4123c8de 100644 --- a/app/models/inactive_contacts.rb +++ b/app/models/inactive_contacts.rb @@ -11,4 +11,4 @@ class InactiveContacts yield contact if block_given? end end -end \ No newline at end of file +end diff --git a/db/migrate/20190404140234_change_log_domains_children_type_to_jsonb.rb b/db/migrate/20190404140234_change_log_domains_children_type_to_jsonb.rb deleted file mode 100644 index b511d7293..000000000 --- a/db/migrate/20190404140234_change_log_domains_children_type_to_jsonb.rb +++ /dev/null @@ -1,5 +0,0 @@ -class ChangeLogDomainsChildrenTypeToJsonb < ActiveRecord::Migration - def change - change_column :log_domains, :children, 'jsonb USING children::jsonb' - end -end \ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index d0c941cb5..806e1a49d 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -4848,4 +4848,5 @@ INSERT INTO "schema_migrations" (version) VALUES ('20200807110611'), ('20200811074839'), ('20200812090409'), -('20200812125810'); +('20200812125810'), +('20200902131603'); diff --git a/lib/tasks/contacts/archive.rake b/lib/tasks/contacts/archive.rake index 1778be98b..80ace6ce0 100644 --- a/lib/tasks/contacts/archive.rake +++ b/lib/tasks/contacts/archive.rake @@ -11,4 +11,4 @@ namespace :contacts do puts "Archived total: #{archived_contacts.count}" end -end \ No newline at end of file +end diff --git a/test/models/contact/archivable_test.rb b/test/models/contact/archivable_test.rb index ebd3b2d12..9b2c75f0b 100644 --- a/test/models/contact/archivable_test.rb +++ b/test/models/contact/archivable_test.rb @@ -67,7 +67,7 @@ class ArchivableContactTest < ActiveSupport::TestCase other_contact = contacts(:william) assert_not_equal other_contact, contact - Domain.update_all(registrant_id: other_contact) + Domain.update_all(registrant_id: other_contact.id) DomainContact.delete_all @@ -78,4 +78,4 @@ class ArchivableContactTest < ActiveSupport::TestCase Contact.inactivity_period = 99.years @contact end -end \ No newline at end of file +end diff --git a/test/models/contact_test.rb b/test/models/contact_test.rb index bbbafc511..1083a54f3 100644 --- a/test/models/contact_test.rb +++ b/test/models/contact_test.rb @@ -267,6 +267,7 @@ class ContactTest < ActiveSupport::TestCase contact = unlinked_contact domains(:shop).update_columns(registrant_id: contact.becomes(Registrant)) + reload assert Contact.unlinked.exclude?(contact), 'Contact should be excluded' end diff --git a/test/tasks/contacts/archive_test.rb b/test/tasks/contacts/archive_test.rb index 54e7a6650..cd137a8c4 100644 --- a/test/tasks/contacts/archive_test.rb +++ b/test/tasks/contacts/archive_test.rb @@ -27,7 +27,7 @@ class ArchiveContactsTaskTest < ActiveSupport::TestCase other_contact = contacts(:william) assert_not_equal other_contact, contact - Domain.update_all(registrant_id: other_contact) + Domain.update_all(registrant_id: other_contact.id) DomainContact.delete_all @@ -43,4 +43,4 @@ class ArchiveContactsTaskTest < ActiveSupport::TestCase def run_task Rake::Task['contacts:archive'].execute end -end \ No newline at end of file +end