move from reading to editable shelf with logic that actually works

This commit is contained in:
Hugh Rundle 2021-11-20 13:57:37 +11:00
parent c6a2de3bbc
commit 41862e854c
No known key found for this signature in database
GPG key ID: CD23D6039184286B

View file

@ -96,7 +96,11 @@ class ReadingStatus(View):
if bool(request.POST.get("shelf")):
# unshelve the existing shelf
this_shelf = request.POST.get("shelf")
if int(this_shelf) not in [1,2,3]:
if (
bool(current_status_shelfbook) and
int(this_shelf) != int(current_status_shelfbook.shelf.id) and
current_status_shelfbook.shelf.identifier != desired_shelf.identifier
):
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"})