diff --git a/bookwyrm/static/js/status_cache.js b/bookwyrm/static/js/status_cache.js index c59e23ee4..49f1c1295 100644 --- a/bookwyrm/static/js/status_cache.js +++ b/bookwyrm/static/js/status_cache.js @@ -192,6 +192,7 @@ let StatusCache = new class { .forEach(item => BookWyrm.addRemoveClass(item, "is-hidden", false)); // Remove existing disabled states + // BUG: this affects all shelves, not just shelving status shelves button.querySelectorAll("[data-shelf-dropdown-identifier] button") .forEach(item => item.disabled = false); diff --git a/bookwyrm/templatetags/bookwyrm_tags.py b/bookwyrm/templatetags/bookwyrm_tags.py index 425ecc158..9d84d1ff8 100644 --- a/bookwyrm/templatetags/bookwyrm_tags.py +++ b/bookwyrm/templatetags/bookwyrm_tags.py @@ -77,7 +77,11 @@ def related_status(notification): def active_shelf(context, book): """check what shelf a user has a book on, if any""" if hasattr(book, "current_shelves"): - read_shelves = [s for s in book.current_shelves if s.shelf.identifier in models.Shelf.READ_STATUS_IDENTIFIERS] + read_shelves = [ + s + for s in book.current_shelves + if s.shelf.identifier in models.Shelf.READ_STATUS_IDENTIFIERS + ] return read_shelves[0] if len(read_shelves) else {"book": book} shelf = ( diff --git a/bookwyrm/views/reading.py b/bookwyrm/views/reading.py index 04074b3db..334235b34 100644 --- a/bookwyrm/views/reading.py +++ b/bookwyrm/views/reading.py @@ -91,17 +91,18 @@ class ReadingStatus(View): 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 bool(request.POST.get("shelf")): # unshelve the existing shelf this_shelf = request.POST.get("shelf") if ( - bool(current_status_shelfbook) and - int(this_shelf) != int(current_status_shelfbook.shelf.id) and - current_status_shelfbook.shelf.identifier != desired_shelf.identifier - ): + 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"}) + return HttpResponse(headers={"forceReload": "true"}) if is_api_request(request): return HttpResponse() diff --git a/bookwyrm/views/shelf/shelf_actions.py b/bookwyrm/views/shelf/shelf_actions.py index 8240055e2..f431c1fab 100644 --- a/bookwyrm/views/shelf/shelf_actions.py +++ b/bookwyrm/views/shelf/shelf_actions.py @@ -102,5 +102,5 @@ def unshelve(request, referer=None, book_id=False): shelf_book.raise_not_deletable(request.user) shelf_book.delete() if bool(referer): - return HttpResponse(headers={"forceReload" : "true"}) + return HttpResponse(headers={"forceReload": "true"}) return redirect(request.headers.get("Referer", "/")) diff --git a/bookwyrm/views/status.py b/bookwyrm/views/status.py index 8488b21e0..eafe0680e 100644 --- a/bookwyrm/views/status.py +++ b/bookwyrm/views/status.py @@ -126,7 +126,7 @@ class CreateStatus(View): # force page reload if this was triggered from 'move' button if bool(request.POST.get("shelf")): - return HttpResponse(headers={"forceReload" : "true"}) + return HttpResponse(headers={"forceReload": "true"}) if is_api_request(request): return HttpResponse()