From 7f41c5c26d5195ae3792f9609b526287fc2a1475 Mon Sep 17 00:00:00 2001 From: olegphenomenon Date: Thu, 20 Oct 2022 15:44:08 +0300 Subject: [PATCH] added contact publisher --- app/controllers/api/v1/registrant/contacts_controller.rb | 2 ++ app/models/contact.rb | 2 +- app/models/whois_record.rb | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/controllers/api/v1/registrant/contacts_controller.rb b/app/controllers/api/v1/registrant/contacts_controller.rb index e88eb05f5..cee2e61a8 100644 --- a/app/controllers/api/v1/registrant/contacts_controller.rb +++ b/app/controllers/api/v1/registrant/contacts_controller.rb @@ -51,6 +51,8 @@ module Api reparsed_request = reparsed_request(request.body.string) + p '-----' + disclosed_attributes = reparsed_request[:disclosed_attributes] render_disclosed_attributes_error and return if disclosed_attributes.present? && contact.org? && diff --git a/app/models/contact.rb b/app/models/contact.rb index e4a2a26ee..c06c7b601 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -65,7 +65,7 @@ class Contact < ApplicationRecord validate :validate_html validate :validate_country_code, if: -> { self.class.address_processing? } validates :registrant_publishable, inclusion: { in: [true, false] }, if: -> { registrant? } - # validates :registrant_publishable, inclusion: { in: [false] }, unless: -> { registrant? } + validates :registrant_publishable, inclusion: { in: [false] }, unless: -> { registrant? } after_initialize do self.status_notes = {} if status_notes.nil? diff --git a/app/models/whois_record.rb b/app/models/whois_record.rb index 69a3cf7d2..893d26440 100644 --- a/app/models/whois_record.rb +++ b/app/models/whois_record.rb @@ -53,7 +53,7 @@ class WhoisRecord < ApplicationRecord h[:email] = registrant.email h[:phone] = registrant.phone h[:registrant_publishable] = registrant.publishable? - h[:registrant_changed] = registrant.updated_at.try(:to_s, :iso8601) + h[:registrant_changed] = registrant.updated_at.try(:to_s, :iso8601) h[:registrant_disclosed_attributes] = registrant.disclosed_attributes h[:admin_contacts] = [] @@ -80,7 +80,6 @@ class WhoisRecord < ApplicationRecord h[:dnssec_keys] = domain.dnskeys.map { |key| "#{key.flags} #{key.protocol} #{key.alg} #{key.public_key}" } h[:dnssec_changed] = domain.dnskeys.pluck(:updated_at).max.try(:to_s, :iso8601) rescue nil - h end @@ -116,6 +115,7 @@ class WhoisRecord < ApplicationRecord email: contact.email, changed: contact.updated_at.try(:to_s, :iso8601), disclosed_attributes: contact.disclosed_attributes, + contact_publishable: contact.registrant_publishable?, } end end