Use new API endpoint to get single contact list

When we first built the contact list feature this endpoint didn’t exist.
Now it does we can remove the slightly cludgy looping-through-all-the-lists
code.
This commit is contained in:
Chris Hill-Scott
2020-03-17 11:30:27 +00:00
parent cb555a4cbe
commit 82634f79de
5 changed files with 42 additions and 10 deletions

View File

@@ -32,11 +32,10 @@ class ContactList(JSONModel):
@classmethod
def from_id(cls, contact_list_id, *, service_id):
# This is temporary until we have a get single list endpoint
for contact_list in ContactLists(service_id):
if contact_list.id == contact_list_id:
return contact_list
abort(404)
return cls(contact_list_api_client.get_contact_list(
service_id=service_id,
contact_list_id=contact_list_id,
))
@staticmethod
def get_bucket_name():