From 36c00c49ab2b00cf163e99b4d08e2921b91fbb54 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Mon, 27 Sep 2021 11:35:32 -0700 Subject: [PATCH] User viewer aware objects for feed suggested books --- bookwyrm/views/feed.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bookwyrm/views/feed.py b/bookwyrm/views/feed.py index 98a1c836c..09d45065b 100644 --- a/bookwyrm/views/feed.py +++ b/bookwyrm/views/feed.py @@ -168,9 +168,11 @@ def get_suggested_books(user, max_books=5): shelf_preview = { "name": shelf.name, "identifier": shelf.identifier, - "books": shelf.books.order_by("shelfbook").prefetch_related("authors")[ - :limit - ], + "books": models.Edition.viewer_aware_objects(user) + .filter( + shelfbook__shelf=shelf, + ) + .prefetch_related("authors")[:limit], } suggested_books.append(shelf_preview) book_count += len(shelf_preview["books"])