From a0821219304f4fa66ac5ed8a7c8a7b50afe185f8 Mon Sep 17 00:00:00 2001 From: Hugh Rundle Date: Sat, 20 Nov 2021 08:55:43 +1100 Subject: [PATCH] fix shelves not being unshelved if any shelf is read-status --- bookwyrm/views/reading.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/bookwyrm/views/reading.py b/bookwyrm/views/reading.py index a96ccbc0..8e6ef9a1 100644 --- a/bookwyrm/views/reading.py +++ b/bookwyrm/views/reading.py @@ -86,15 +86,19 @@ class ReadingStatus(View): if request.POST.get("post-status"): # is it a comment? if request.POST.get("content"): - # BUG: there is a problem posting statuses for finishing - # check whether it existed before. + # BUG: there is a problem posting statuses with comments (doesn't force reload) + # there is a DIFFERENT problem *updating* read statuses/comments return CreateStatus.as_view()(request, "comment") privacy = request.POST.get("privacy") handle_reading_status(request.user, desired_shelf, book, privacy) + # if the request includes a "shelf" value we are using the 'move' button if bool(request.POST.get("shelf")): - if current_status_shelfbook is None: + # unshelve the existing shelf + this_shelf = request.POST.get("shelf") + if int(this_shelf) not in [1,2,3]: return unshelve(request, referer=referer, book_id=book_id) + # don't try to unshelve a read status shelf: it has already been deleted. return HttpResponse(headers={"forceReload" : "true"}) if is_api_request(request):