mirror of
https://github.com/jointakahe/takahe.git
synced 2024-11-29 02:31:00 +00:00
parent
1994671541
commit
ea7d5f307c
2 changed files with 17 additions and 6 deletions
|
@ -75,10 +75,16 @@ def update_credentials(
|
||||||
|
|
||||||
@scope_required("read")
|
@scope_required("read")
|
||||||
@api_view.get
|
@api_view.get
|
||||||
def account_relationships(request, id: list[str] | None) -> list[schemas.Relationship]:
|
def account_relationships(
|
||||||
|
request, id: list[str] | str | None
|
||||||
|
) -> list[schemas.Relationship]:
|
||||||
result = []
|
result = []
|
||||||
# ID is actually a list. Thanks Mastodon!
|
if isinstance(id, str):
|
||||||
ids = id or []
|
ids = [id]
|
||||||
|
elif id is None:
|
||||||
|
ids = []
|
||||||
|
else:
|
||||||
|
ids = id
|
||||||
for actual_id in ids:
|
for actual_id in ids:
|
||||||
identity = get_object_or_404(Identity, pk=actual_id)
|
identity = get_object_or_404(Identity, pk=actual_id)
|
||||||
result.append(
|
result.append(
|
||||||
|
@ -90,12 +96,17 @@ def account_relationships(request, id: list[str] | None) -> list[schemas.Relatio
|
||||||
@scope_required("read")
|
@scope_required("read")
|
||||||
@api_view.get
|
@api_view.get
|
||||||
def familiar_followers(
|
def familiar_followers(
|
||||||
request, id: list[str] | None
|
request, id: list[str] | str | None
|
||||||
) -> list[schemas.FamiliarFollowers]:
|
) -> list[schemas.FamiliarFollowers]:
|
||||||
"""
|
"""
|
||||||
Returns people you follow that also follow given account IDs
|
Returns people you follow that also follow given account IDs
|
||||||
"""
|
"""
|
||||||
ids = id or []
|
if isinstance(id, str):
|
||||||
|
ids = [id]
|
||||||
|
elif id is None:
|
||||||
|
ids = []
|
||||||
|
else:
|
||||||
|
ids = id
|
||||||
result = []
|
result = []
|
||||||
for actual_id in ids:
|
for actual_id in ids:
|
||||||
target_identity = get_object_or_404(Identity, pk=actual_id)
|
target_identity = get_object_or_404(Identity, pk=actual_id)
|
||||||
|
|
|
@ -5,7 +5,7 @@ dj_database_url~=1.0.0
|
||||||
django-cache-url~=3.4.2
|
django-cache-url~=3.4.2
|
||||||
django-cors-headers~=3.13.0
|
django-cors-headers~=3.13.0
|
||||||
django-debug-toolbar~=3.8.1
|
django-debug-toolbar~=3.8.1
|
||||||
django-hatchway~=0.5.0
|
django-hatchway~=0.5.1
|
||||||
django-htmx~=1.13.0
|
django-htmx~=1.13.0
|
||||||
django-oauth-toolkit~=2.2.0
|
django-oauth-toolkit~=2.2.0
|
||||||
django-storages[google,boto3]~=1.13.1
|
django-storages[google,boto3]~=1.13.1
|
||||||
|
|
Loading…
Reference in a new issue