Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion app/jobs/org_registrant_phone_checker_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,10 @@ def call_disclosure_action(is_phone_number_matching, contact)
if is_phone_number_matching
disclose_phone_number(contact)
log("Phone number disclosed for registrant user #{contact.code}. Phone number: #{contact.phone}")
elsif contact.disclosed_attributes.include?('phone')
elsif contact.disclosed_attributes.include?('phone') || contact.system_disclosed_attributes.include?('phone')
log("Removing phone number from disclosed attributes for registrant user #{contact.code}. Phone number: #{contact.phone}")
contact.disclosed_attributes.delete('phone')
contact.system_disclosed_attributes.delete('phone')
contact.save!
else
log("Phone number not disclosed for registrant user #{contact.code}. Phone number: #{contact.phone}")
Expand All @@ -69,6 +70,7 @@ def log(message)

def disclose_phone_number(contact)
contact.disclosed_attributes << 'phone'
contact.system_disclosed_attributes << 'phone'
contact.save!
end

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddSystemDisclosedAttributesToContact < ActiveRecord::Migration[6.1]
def change
add_column :contacts, :system_disclosed_attributes, :string, array: true, default: []
end
end
6 changes: 4 additions & 2 deletions db/structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,8 @@ CREATE TABLE public.contacts (
company_register_status character varying,
ident_request_sent_at timestamp without time zone,
verified_at timestamp without time zone,
verification_id character varying
verification_id character varying,
system_disclosed_attributes character varying[] DEFAULT '{}'::character varying[]
);


Expand Down Expand Up @@ -5728,6 +5729,7 @@ INSERT INTO "schema_migrations" (version) VALUES
('20250204094550'),
('20250219102811'),
('20250313122119'),
('20250319104749');
('20250319104749'),
('20250627084536');


1 change: 1 addition & 0 deletions lib/serializers/registrant_api/contact.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def to_json(_obj = nil)
auth_info: contact.auth_info,
statuses: contact.statuses,
disclosed_attributes: contact.disclosed_attributes,
system_disclosed_attributes: contact.system_disclosed_attributes,
registrant_publishable: contact.registrant_publishable,
}

Expand Down
3 changes: 2 additions & 1 deletion test/integration/api/v1/registrant/contacts/details_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ def test_returns_contact_details
auth_info: @contact.auth_info,
statuses: @contact.statuses,
disclosed_attributes: @contact.disclosed_attributes,
registrant_publishable: @contact.registrant_publishable }),
registrant_publishable: @contact.registrant_publishable,
system_disclosed_attributes: @contact.system_disclosed_attributes }),
JSON.parse(response.body, symbolize_names: true)
end

Expand Down