User viewer aware objects for feed suggested books

This commit is contained in:
Mouse Reeve 2021-09-27 11:35:32 -07:00
parent ba4df5b38b
commit 36c00c49ab

View file

@ -168,9 +168,11 @@ def get_suggested_books(user, max_books=5):
shelf_preview = { shelf_preview = {
"name": shelf.name, "name": shelf.name,
"identifier": shelf.identifier, "identifier": shelf.identifier,
"books": shelf.books.order_by("shelfbook").prefetch_related("authors")[ "books": models.Edition.viewer_aware_objects(user)
:limit .filter(
], shelfbook__shelf=shelf,
)
.prefetch_related("authors")[:limit],
} }
suggested_books.append(shelf_preview) suggested_books.append(shelf_preview)
book_count += len(shelf_preview["books"]) book_count += len(shelf_preview["books"])