mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-23 08:36:32 +00:00
Don't display empty shelves on user page
This commit is contained in:
parent
a7afd4c47b
commit
e674f85d4e
1 changed files with 2 additions and 1 deletions
|
@ -31,12 +31,13 @@ class User(View):
|
||||||
shelf_preview = []
|
shelf_preview = []
|
||||||
|
|
||||||
# only show shelves that should be visible
|
# only show shelves that should be visible
|
||||||
shelves = user.shelf_set
|
|
||||||
is_self = request.user.id == user.id
|
is_self = request.user.id == user.id
|
||||||
if not is_self:
|
if not is_self:
|
||||||
shelves = models.Shelf.privacy_filter(
|
shelves = models.Shelf.privacy_filter(
|
||||||
request.user, privacy_levels=["public", "followers"]
|
request.user, privacy_levels=["public", "followers"]
|
||||||
).filter(user=user, books__isnull=False)
|
).filter(user=user, books__isnull=False)
|
||||||
|
else:
|
||||||
|
shelves = user.shelf_set.filter(books__isnull=False).distinct()
|
||||||
|
|
||||||
for user_shelf in shelves.all()[:3]:
|
for user_shelf in shelves.all()[:3]:
|
||||||
shelf_preview.append(
|
shelf_preview.append(
|
||||||
|
|
Loading…
Reference in a new issue