mirror of
https://github.com/jointakahe/takahe.git
synced 2024-11-26 01:01:00 +00:00
Handle old IDs coming in for pagination
This commit is contained in:
parent
4a1e375e3c
commit
024d956e5e
1 changed files with 8 additions and 8 deletions
|
@ -136,13 +136,13 @@ class MastodonPaginator:
|
||||||
since_id: str | None,
|
since_id: str | None,
|
||||||
limit: int | None,
|
limit: int | None,
|
||||||
) -> PaginationResult:
|
) -> PaginationResult:
|
||||||
if max_id:
|
# These "does not start with interaction" checks can be removed after a
|
||||||
|
# couple months, when clients have flushed them out.
|
||||||
|
if max_id and not max_id.startswith("interaction"):
|
||||||
queryset = queryset.filter(id__lt=max_id)
|
queryset = queryset.filter(id__lt=max_id)
|
||||||
|
if since_id and not since_id.startswith("interaction"):
|
||||||
if since_id:
|
|
||||||
queryset = queryset.filter(id__gt=since_id)
|
queryset = queryset.filter(id__gt=since_id)
|
||||||
|
if min_id and not min_id.startswith("interaction"):
|
||||||
if min_id:
|
|
||||||
# Min ID requires items _immediately_ newer than specified, so we
|
# Min ID requires items _immediately_ newer than specified, so we
|
||||||
# invert the ordering to accommodate
|
# invert the ordering to accommodate
|
||||||
queryset = queryset.filter(id__gt=min_id).order_by("id")
|
queryset = queryset.filter(id__gt=min_id).order_by("id")
|
||||||
|
@ -167,19 +167,19 @@ class MastodonPaginator:
|
||||||
The home timeline requires special handling where we mix Posts and
|
The home timeline requires special handling where we mix Posts and
|
||||||
PostInteractions together.
|
PostInteractions together.
|
||||||
"""
|
"""
|
||||||
if max_id:
|
if max_id and not max_id.startswith("interaction"):
|
||||||
queryset = queryset.filter(
|
queryset = queryset.filter(
|
||||||
models.Q(subject_post_id__lt=max_id)
|
models.Q(subject_post_id__lt=max_id)
|
||||||
| models.Q(subject_post_interaction_id__lt=max_id)
|
| models.Q(subject_post_interaction_id__lt=max_id)
|
||||||
)
|
)
|
||||||
|
|
||||||
if since_id:
|
if since_id and not since_id.startswith("interaction"):
|
||||||
queryset = queryset.filter(
|
queryset = queryset.filter(
|
||||||
models.Q(subject_post_id__gt=since_id)
|
models.Q(subject_post_id__gt=since_id)
|
||||||
| models.Q(subject_post_interaction_id__gt=since_id)
|
| models.Q(subject_post_interaction_id__gt=since_id)
|
||||||
)
|
)
|
||||||
|
|
||||||
if min_id:
|
if min_id and not min_id.startswith("interaction"):
|
||||||
# Min ID requires items _immediately_ newer than specified, so we
|
# Min ID requires items _immediately_ newer than specified, so we
|
||||||
# invert the ordering to accommodate
|
# invert the ordering to accommodate
|
||||||
queryset = queryset.filter(
|
queryset = queryset.filter(
|
||||||
|
|
Loading…
Reference in a new issue