From 7cfb0a427192dbe822c5fe8f3a2fd15dee43822a Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sun, 12 Sep 2021 11:45:18 -0700 Subject: [PATCH 1/3] Supports Safari in form submission event --- bookwyrm/static/js/status_cache.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/bookwyrm/static/js/status_cache.js b/bookwyrm/static/js/status_cache.js index a6eaf0341..db60341e8 100644 --- a/bookwyrm/static/js/status_cache.js +++ b/bookwyrm/static/js/status_cache.js @@ -64,9 +64,19 @@ let StatusCache = new class { * @return {undefined} */ submitStatus(event) { - event.preventDefault(); const form = event.currentTarget; - const trigger = event.submitter; + let trigger = event.submitter; + + // Safari doesn't understand "submitter" + if (!trigger) { + trigger = event.currentTarget.querySelector("button[type=submit]"); + } + // this allows the form to submit in the old fashioned way if there's a problem + if (!trigger || !form) { + return; + } + + event.preventDefault(); BookWyrm.addRemoveClass(form, 'is-processing', true); trigger.setAttribute('disabled', null); From a13d3317c679d433c35a0dc8ab36b72aad562074 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sun, 12 Sep 2021 11:46:51 -0700 Subject: [PATCH 2/3] Bust javascript cache --- bookwyrm/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bookwyrm/settings.py b/bookwyrm/settings.py index 420d840a6..452b8d940 100644 --- a/bookwyrm/settings.py +++ b/bookwyrm/settings.py @@ -13,7 +13,7 @@ VERSION = "0.0.1" PAGE_LENGTH = env("PAGE_LENGTH", 15) DEFAULT_LANGUAGE = env("DEFAULT_LANGUAGE", "English") -JS_CACHE = "19447742" +JS_CACHE = "e5832a26" # email EMAIL_BACKEND = env("EMAIL_BACKEND", "django.core.mail.backends.smtp.EmailBackend") From ccdfaa31874f7b154a33c0d252180ad281bc80e0 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sun, 12 Sep 2021 11:48:25 -0700 Subject: [PATCH 3/3] Linter fixes --- bookwyrm/static/js/status_cache.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bookwyrm/static/js/status_cache.js b/bookwyrm/static/js/status_cache.js index db60341e8..b3e345b19 100644 --- a/bookwyrm/static/js/status_cache.js +++ b/bookwyrm/static/js/status_cache.js @@ -71,7 +71,9 @@ let StatusCache = new class { if (!trigger) { trigger = event.currentTarget.querySelector("button[type=submit]"); } - // this allows the form to submit in the old fashioned way if there's a problem + + // This allows the form to submit in the old fashioned way if there's a problem + if (!trigger || !form) { return; }