added contact publisher

This commit is contained in:
olegphenomenon 2022-10-20 15:44:08 +03:00
parent 84aa93e97b
commit 7f41c5c26d
3 changed files with 5 additions and 3 deletions

View file

@ -51,6 +51,8 @@ module Api
reparsed_request = reparsed_request(request.body.string) reparsed_request = reparsed_request(request.body.string)
p '-----'
disclosed_attributes = reparsed_request[:disclosed_attributes] disclosed_attributes = reparsed_request[:disclosed_attributes]
render_disclosed_attributes_error and return if disclosed_attributes.present? && contact.org? && render_disclosed_attributes_error and return if disclosed_attributes.present? && contact.org? &&

View file

@ -65,7 +65,7 @@ class Contact < ApplicationRecord
validate :validate_html validate :validate_html
validate :validate_country_code, if: -> { self.class.address_processing? } validate :validate_country_code, if: -> { self.class.address_processing? }
validates :registrant_publishable, inclusion: { in: [true, false] }, if: -> { registrant? } 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 after_initialize do
self.status_notes = {} if status_notes.nil? self.status_notes = {} if status_notes.nil?

View file

@ -53,7 +53,7 @@ class WhoisRecord < ApplicationRecord
h[:email] = registrant.email h[:email] = registrant.email
h[:phone] = registrant.phone h[:phone] = registrant.phone
h[:registrant_publishable] = registrant.publishable? 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[:registrant_disclosed_attributes] = registrant.disclosed_attributes
h[:admin_contacts] = [] 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_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[:dnssec_changed] = domain.dnskeys.pluck(:updated_at).max.try(:to_s, :iso8601) rescue nil
h h
end end
@ -116,6 +115,7 @@ class WhoisRecord < ApplicationRecord
email: contact.email, email: contact.email,
changed: contact.updated_at.try(:to_s, :iso8601), changed: contact.updated_at.try(:to_s, :iso8601),
disclosed_attributes: contact.disclosed_attributes, disclosed_attributes: contact.disclosed_attributes,
contact_publishable: contact.registrant_publishable?,
} }
end end
end end