From 951eb43aa657d9ced537b078bf14286520b18a66 Mon Sep 17 00:00:00 2001 From: Hugh Rundle Date: Fri, 26 Nov 2021 17:16:26 +1100 Subject: [PATCH] bypass ajax for shelf_selector statuses --- bookwyrm/static/js/status_cache.js | 3 +-- .../snippets/reading_modals/finish_reading_modal.html | 2 +- .../snippets/reading_modals/start_reading_modal.html | 2 +- .../snippets/reading_modals/want_to_read_modal.html | 2 +- bookwyrm/templates/snippets/shelf_selector.html | 6 +++--- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/bookwyrm/static/js/status_cache.js b/bookwyrm/static/js/status_cache.js index 1ec72b3cb..418b7dee2 100644 --- a/bookwyrm/static/js/status_cache.js +++ b/bookwyrm/static/js/status_cache.js @@ -74,7 +74,7 @@ let StatusCache = new class { // This allows the form to submit in the old fashioned way if there's a problem - if (!trigger || !form || response.headers.get("forceReload")) { + if (!trigger || !form) { return; } @@ -90,7 +90,6 @@ let StatusCache = new class { trigger.removeAttribute('disabled'); }) .then(response => { - if (!response.ok) { throw new Error(); } diff --git a/bookwyrm/templates/snippets/reading_modals/finish_reading_modal.html b/bookwyrm/templates/snippets/reading_modals/finish_reading_modal.html index 79542b29a..a35ed9e0b 100644 --- a/bookwyrm/templates/snippets/reading_modals/finish_reading_modal.html +++ b/bookwyrm/templates/snippets/reading_modals/finish_reading_modal.html @@ -9,7 +9,7 @@ Finish "{{ book_title }}" {% endblock %} {% block modal-form-open %} -
+ {% csrf_token %} diff --git a/bookwyrm/templates/snippets/reading_modals/start_reading_modal.html b/bookwyrm/templates/snippets/reading_modals/start_reading_modal.html index 03ebd9003..423f77ebe 100644 --- a/bookwyrm/templates/snippets/reading_modals/start_reading_modal.html +++ b/bookwyrm/templates/snippets/reading_modals/start_reading_modal.html @@ -9,7 +9,7 @@ Start "{{ book_title }}" {% endblock %} {% block modal-form-open %} - + {% csrf_token %} diff --git a/bookwyrm/templates/snippets/reading_modals/want_to_read_modal.html b/bookwyrm/templates/snippets/reading_modals/want_to_read_modal.html index 2fc2a012d..2fb976bf1 100644 --- a/bookwyrm/templates/snippets/reading_modals/want_to_read_modal.html +++ b/bookwyrm/templates/snippets/reading_modals/want_to_read_modal.html @@ -9,7 +9,7 @@ Want to Read "{{ book_title }}" {% endblock %} {% block modal-form-open %} - + {% csrf_token %} diff --git a/bookwyrm/templates/snippets/shelf_selector.html b/bookwyrm/templates/snippets/shelf_selector.html index 663bd5633..4b32f5a8e 100644 --- a/bookwyrm/templates/snippets/shelf_selector.html +++ b/bookwyrm/templates/snippets/shelf_selector.html @@ -78,11 +78,11 @@ {% endif %} -{% include 'snippets/reading_modals/want_to_read_modal.html' with book=active_shelf.book controls_text="want_to_read" controls_uid=uuid move_from=current.id %} +{% include 'snippets/reading_modals/want_to_read_modal.html' with book=active_shelf.book controls_text="want_to_read" controls_uid=uuid move_from=current.id refresh=True %} -{% include 'snippets/reading_modals/start_reading_modal.html' with book=active_shelf.book controls_text="start_reading" controls_uid=uuid move_from=current.id %} +{% include 'snippets/reading_modals/start_reading_modal.html' with book=active_shelf.book controls_text="start_reading" controls_uid=uuid move_from=current.id refresh=True %} -{% include 'snippets/reading_modals/finish_reading_modal.html' with book=active_shelf.book controls_text="finish_reading" controls_uid=uuid move_from=current.id readthrough=readthrough %} +{% include 'snippets/reading_modals/finish_reading_modal.html' with book=active_shelf.book controls_text="finish_reading" controls_uid=uuid move_from=current.id readthrough=readthrough refresh=True %} {% endwith %} {% endblock %}