diff --git a/bookwyrm/templates/user/followers.html b/bookwyrm/templates/user/followers.html index 45d87a3d..b294db90 100644 --- a/bookwyrm/templates/user/followers.html +++ b/bookwyrm/templates/user/followers.html @@ -29,4 +29,6 @@
{% blocktrans with username=user.display_name %}{{ username }} has no followers{% endblocktrans %}
{% endif %} + +{% include 'snippets/pagination.html' with page=followers path=request.path %} {% endblock %} diff --git a/bookwyrm/templates/user/following.html b/bookwyrm/templates/user/following.html index 5904c1bb..38c01ad2 100644 --- a/bookwyrm/templates/user/following.html +++ b/bookwyrm/templates/user/following.html @@ -29,4 +29,6 @@
{% blocktrans with username=user|username %}{{ username }} isn't following any users{% endblocktrans %}
{% endif %} + +{% include 'snippets/pagination.html' with page=following path=request.path %} {% endblock %} diff --git a/bookwyrm/views/notifications.py b/bookwyrm/views/notifications.py index e0e2102d..3d08cade 100644 --- a/bookwyrm/views/notifications.py +++ b/bookwyrm/views/notifications.py @@ -16,7 +16,7 @@ class Notifications(View): notifications = request.user.notification_set.all().order_by("-created_date") unread = [n.id for n in notifications.filter(read=False)] data = { - "notifications": notifications, + "notifications": notifications[:50], "unread": unread, } notifications.update(read=True) diff --git a/bookwyrm/views/user.py b/bookwyrm/views/user.py index 05fdb606..d394c1d7 100644 --- a/bookwyrm/views/user.py +++ b/bookwyrm/views/user.py @@ -106,10 +106,11 @@ class Followers(View): if is_api_request(request): return ActivitypubResponse(user.to_followers_activity(**request.GET)) + paginated = Paginator(user.followers.all(), PAGE_LENGTH) data = { "user": user, "is_self": request.user.id == user.id, - "followers": user.followers.all(), + "followers": paginated.page(request.GET.get("page", 1)), } return TemplateResponse(request, "user/followers.html", data) @@ -131,10 +132,11 @@ class Following(View): if is_api_request(request): return ActivitypubResponse(user.to_following_activity(**request.GET)) + paginated = Paginator(user.followers.all(), PAGE_LENGTH) data = { "user": user, "is_self": request.user.id == user.id, - "following": user.following.all(), + "following": paginated.page(request.GET.get("page", 1)), } return TemplateResponse(request, "user/following.html", data)