Skip to content

Commit

Permalink
Don't return phone number in the old API
Browse files Browse the repository at this point in the history
  • Loading branch information
samnang committed Jan 23, 2025
1 parent 96e325b commit eb36814
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions app/models/callout_participation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ def self.still_trying(max_phone_calls)
where(answered: false).where(arel_table[:phone_calls_count].lt(max_phone_calls))
end

# NOTE: This is for backward compatibility until we moved to the new API
def as_json(*)
result = super
result["msisdn"] = result.delete("phone_number")
result
end

private

def set_phone_number_from_contact
Expand Down
2 changes: 1 addition & 1 deletion app/models/contact.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def self.jsonapi_serializer_class
# NOTE: This is for backward compatibility until we moved to the new API
def as_json(*)
result = super
result["msisdn"] = result["phone_number"]
result["msisdn"] = result.delete("phone_number")
result
end
end
2 changes: 1 addition & 1 deletion app/models/phone_call.rb
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def remote_call_expired?
# NOTE: This is for backward compatibility until we moved to the new API
def as_json(*)
result = super
result["msisdn"] = result["phone_number"]
result["msisdn"] = result.delete("phone_number")
result
end

Expand Down

0 comments on commit eb36814

Please sign in to comment.