From a3270551f9e299c5fb093d61244dedd4c86d1495 Mon Sep 17 00:00:00 2001 From: Hugh Rundle Date: Sat, 20 Nov 2021 19:19:51 +1100 Subject: [PATCH] code cleanup --- bookwyrm/static/js/status_cache.js | 2 ++ bookwyrm/views/reading.py | 1 + bookwyrm/views/shelf/shelf_actions.py | 4 ++-- bookwyrm/views/status.py | 1 + 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/bookwyrm/static/js/status_cache.js b/bookwyrm/static/js/status_cache.js index 49f1c129..03301a21 100644 --- a/bookwyrm/static/js/status_cache.js +++ b/bookwyrm/static/js/status_cache.js @@ -93,8 +93,10 @@ let StatusCache = new class { if (response.headers.get("forceReload")) { BookWyrm.addRemoveClass(form, 'is-processing', true); trigger.setAttribute('disabled', null); + return location.reload(); } + if (!response.ok) { throw new Error(); } diff --git a/bookwyrm/views/reading.py b/bookwyrm/views/reading.py index 334235b3..75a45f24 100644 --- a/bookwyrm/views/reading.py +++ b/bookwyrm/views/reading.py @@ -17,6 +17,7 @@ from .helpers import load_date_in_user_tz_as_utc @method_decorator(login_required, name="dispatch") # pylint: disable=no-self-use +# pylint: disable=too-many-return-statements class ReadingStatus(View): """consider reading a book""" diff --git a/bookwyrm/views/shelf/shelf_actions.py b/bookwyrm/views/shelf/shelf_actions.py index f431c1fa..77053f53 100644 --- a/bookwyrm/views/shelf/shelf_actions.py +++ b/bookwyrm/views/shelf/shelf_actions.py @@ -94,8 +94,8 @@ def shelve(request): @require_POST def unshelve(request, referer=None, book_id=False): """remove a book from a user's shelf""" - id = book_id if book_id else request.POST.get("book") - book = get_object_or_404(models.Edition, id=id) + identity = book_id if book_id else request.POST.get("book") + book = get_object_or_404(models.Edition, id=identity) shelf_book = get_object_or_404( models.ShelfBook, book=book, shelf__id=request.POST["shelf"] ) diff --git a/bookwyrm/views/status.py b/bookwyrm/views/status.py index 588dcf6a..144408b5 100644 --- a/bookwyrm/views/status.py +++ b/bookwyrm/views/status.py @@ -54,6 +54,7 @@ class CreateStatus(View): data = {"book": book} return TemplateResponse(request, "compose.html", data) + # pylint: disable=too-many-branches def post(self, request, status_type, existing_status_id=None): """create status of whatever type""" created = not existing_status_id