mirror of
https://github.com/jointakahe/takahe.git
synced 2025-06-05 10:18:50 +00:00
Move familiar followers to right place for URL
This commit is contained in:
parent
beff63bbac
commit
d3b9db581e
1 changed files with 27 additions and 27 deletions
|
@ -28,6 +28,33 @@ def account_relationships(request):
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
@api_router.get(
|
||||||
|
"/v1/accounts/familiar_followers", response=list[schemas.FamiliarFollowers]
|
||||||
|
)
|
||||||
|
@identity_required
|
||||||
|
def familiar_followers(request):
|
||||||
|
"""
|
||||||
|
Returns people you follow that also follow given account IDs
|
||||||
|
"""
|
||||||
|
ids = request.GET.getlist("id[]")
|
||||||
|
result = []
|
||||||
|
for id in ids:
|
||||||
|
target_identity = get_object_or_404(Identity, pk=id)
|
||||||
|
result.append(
|
||||||
|
{
|
||||||
|
"id": id,
|
||||||
|
"accounts": [
|
||||||
|
identity.to_mastodon_json()
|
||||||
|
for identity in Identity.objects.filter(
|
||||||
|
inbound_follows__source=request.identity,
|
||||||
|
outbound_follows__target=target_identity,
|
||||||
|
)[:20]
|
||||||
|
],
|
||||||
|
}
|
||||||
|
)
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
@api_router.get("/v1/accounts/{id}", response=schemas.Account)
|
@api_router.get("/v1/accounts/{id}", response=schemas.Account)
|
||||||
@identity_required
|
@identity_required
|
||||||
def account(request, id: str):
|
def account(request, id: str):
|
||||||
|
@ -100,30 +127,3 @@ def account_unfollow(request, id: str):
|
||||||
service = IdentityService(identity)
|
service = IdentityService(identity)
|
||||||
service.unfollow_from(request.identity)
|
service.unfollow_from(request.identity)
|
||||||
return service.mastodon_json_relationship(request.identity)
|
return service.mastodon_json_relationship(request.identity)
|
||||||
|
|
||||||
|
|
||||||
@api_router.get(
|
|
||||||
"/v1/accounts/familiar_followers", response=list[schemas.FamiliarFollowers]
|
|
||||||
)
|
|
||||||
@identity_required
|
|
||||||
def familiar_followers(request):
|
|
||||||
"""
|
|
||||||
Returns people you follow that also follow given account IDs
|
|
||||||
"""
|
|
||||||
ids = request.GET.getlist("id[]")
|
|
||||||
result = []
|
|
||||||
for id in ids:
|
|
||||||
target_identity = get_object_or_404(Identity, pk=id)
|
|
||||||
result.append(
|
|
||||||
{
|
|
||||||
"id": id,
|
|
||||||
"accounts": [
|
|
||||||
identity.to_mastodon_json()
|
|
||||||
for identity in Identity.objects.filter(
|
|
||||||
inbound_follows__source=request.identity,
|
|
||||||
outbound_follows__target=target_identity,
|
|
||||||
)[:20]
|
|
||||||
],
|
|
||||||
}
|
|
||||||
)
|
|
||||||
return result
|
|
||||||
|
|
Loading…
Reference in a new issue