fix /v1/statuses/<id>/favourited_by pagination header error (#550)

This commit is contained in:
Christof Dorner 2023-03-24 02:09:03 +01:00 committed by GitHub
parent e45195bb02
commit ba4414dbce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -16,7 +16,7 @@ from activities.models import (
from activities.services import PostService from activities.services import PostService
from api import schemas from api import schemas
from api.decorators import scope_required from api.decorators import scope_required
from api.pagination import MastodonPaginator, PaginationResult from api.pagination import MastodonPaginator, PaginatingApiResponse, PaginationResult
from core.models import Config from core.models import Config
@ -230,10 +230,7 @@ def favourited_by(
limit=limit, limit=limit,
) )
headers = {} return PaginatingApiResponse(
if pager.results:
headers = {"link": pager.link_header(request, ["limit"])}
return ApiResponse(
[ [
schemas.Account.from_identity( schemas.Account.from_identity(
interaction.identity, interaction.identity,
@ -241,7 +238,11 @@ def favourited_by(
) )
for interaction in pager.results for interaction in pager.results
], ],
headers=headers, request=request,
include_params=[
"limit",
"id",
],
) )