Skip to content

Commit df5e451

Browse files
authored
Merge pull request #2818 from internetee/disclose-phone-number-for-org-registrants
feat: Add system disclosed attributes for contact phone numbers
2 parents 42fb0bb + 79e8bcc commit df5e451

File tree

5 files changed

+15
-4
lines changed

5 files changed

+15
-4
lines changed

app/jobs/org_registrant_phone_checker_job.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,10 @@ def call_disclosure_action(is_phone_number_matching, contact)
5454
if is_phone_number_matching
5555
disclose_phone_number(contact)
5656
log("Phone number disclosed for registrant user #{contact.code}. Phone number: #{contact.phone}")
57-
elsif contact.disclosed_attributes.include?('phone')
57+
elsif contact.disclosed_attributes.include?('phone') || contact.system_disclosed_attributes.include?('phone')
5858
log("Removing phone number from disclosed attributes for registrant user #{contact.code}. Phone number: #{contact.phone}")
5959
contact.disclosed_attributes.delete('phone')
60+
contact.system_disclosed_attributes.delete('phone')
6061
contact.save!
6162
else
6263
log("Phone number not disclosed for registrant user #{contact.code}. Phone number: #{contact.phone}")
@@ -69,6 +70,7 @@ def log(message)
6970

7071
def disclose_phone_number(contact)
7172
contact.disclosed_attributes << 'phone'
73+
contact.system_disclosed_attributes << 'phone'
7274
contact.save!
7375
end
7476

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class AddSystemDisclosedAttributesToContact < ActiveRecord::Migration[6.1]
2+
def change
3+
add_column :contacts, :system_disclosed_attributes, :string, array: true, default: []
4+
end
5+
end

db/structure.sql

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,8 @@ CREATE TABLE public.contacts (
732732
company_register_status character varying,
733733
ident_request_sent_at timestamp without time zone,
734734
verified_at timestamp without time zone,
735-
verification_id character varying
735+
verification_id character varying,
736+
system_disclosed_attributes character varying[] DEFAULT '{}'::character varying[]
736737
);
737738

738739

@@ -5785,6 +5786,7 @@ INSERT INTO "schema_migrations" (version) VALUES
57855786
('20250314133357'),
57865787
('20240722085530'),
57875788
('20240723110208'),
5788-
('20241022121525');
5789+
('20241022121525'),
5790+
('20250627084536');
57895791

57905792

lib/serializers/registrant_api/contact.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ def to_json(_obj = nil)
3131
auth_info: contact.auth_info,
3232
statuses: contact.statuses,
3333
disclosed_attributes: contact.disclosed_attributes,
34+
system_disclosed_attributes: contact.system_disclosed_attributes,
3435
registrant_publishable: contact.registrant_publishable,
3536
}
3637

test/integration/api/v1/registrant/contacts/details_test.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ def test_returns_contact_details
3939
auth_info: @contact.auth_info,
4040
statuses: @contact.statuses,
4141
disclosed_attributes: @contact.disclosed_attributes,
42-
registrant_publishable: @contact.registrant_publishable }),
42+
registrant_publishable: @contact.registrant_publishable,
43+
system_disclosed_attributes: @contact.system_disclosed_attributes }),
4344
JSON.parse(response.body, symbolize_names: true)
4445
end
4546

0 commit comments

Comments
 (0)