Adds privacy to fake shelf

This commit is contained in:
Mouse Reeve 2021-03-31 10:32:50 -07:00
parent a670c8d366
commit f89e94b0c0

View file

@ -44,11 +44,13 @@ class Shelf(View):
return HttpResponseNotFound() return HttpResponseNotFound()
# this is a constructed "all books" view, with a fake "shelf" obj # this is a constructed "all books" view, with a fake "shelf" obj
else: else:
FakeShelf = namedtuple("Shelf", ("identifier", "name", "user", "books")) FakeShelf = namedtuple(
"Shelf", ("identifier", "name", "user", "books", "privacy")
)
books = models.Edition.objects.filter( books = models.Edition.objects.filter(
shelfbook__shelf__in=shelves.all() shelfbook__shelf__in=shelves.all()
).distinct() ).distinct()
shelf = FakeShelf("all", _("All books"), user, books) shelf = FakeShelf("all", _("All books"), user, books, "public")
is_self = request.user == user is_self = request.user == user