From b24c654f73ec7c23d9eee215eb8191e72814a815 Mon Sep 17 00:00:00 2001 From: NubWizard Date: Fri, 9 Jun 2023 12:19:19 -0500 Subject: [PATCH] Fixes exception issues that I commented out for troubleshooting --- tildes/static/js/scripts.js | 6 ++--- tildes/templates/settings_wpm.jinja2 | 32 +++++++++++++++++++++++ tildes/tildes/views/api/web/exceptions.py | 4 +-- 3 files changed, 37 insertions(+), 5 deletions(-) create mode 100644 tildes/templates/settings_wpm.jinja2 diff --git a/tildes/static/js/scripts.js b/tildes/static/js/scripts.js index d4fc7cc..39ab25f 100644 --- a/tildes/static/js/scripts.js +++ b/tildes/static/js/scripts.js @@ -84,9 +84,9 @@ $(function() { } // check if the response came back as HTML (unhandled error of some sort) - //if (errorText.lastIndexOf("", 500) !== -1) { - // errorText = "Unknown error"; - //} + if (errorText.lastIndexOf("", 500) !== -1) { + errorText = "Unknown error"; + } $statusElement.addClass("text-error").text(errorText); } diff --git a/tildes/templates/settings_wpm.jinja2 b/tildes/templates/settings_wpm.jinja2 new file mode 100644 index 0000000..0d3b38f --- /dev/null +++ b/tildes/templates/settings_wpm.jinja2 @@ -0,0 +1,32 @@ +{# Copyright (c) 2023 Tildes contributors #} +{# SPDX-License-Identifier: AGPL-3.0-or-later #} + +{% extends 'base_settings.jinja2' %} + +{% block title %}Edit your reading speed{% endblock %} + +{% block main_heading %}Edit your reading speed{% endblock %} + +{% block settings %} +

Enter your estimated reading speed in words per minute (WPM). This will be used to calculate estimated reading times for posts. To disable reading time from displaying on Link topics, enter a value of 0.

+ +
+ +
+
+ + +
+ +
+ +
+
+{% endblock %} diff --git a/tildes/tildes/views/api/web/exceptions.py b/tildes/tildes/views/api/web/exceptions.py index 8f3c0fa..827ba61 100644 --- a/tildes/tildes/views/api/web/exceptions.py +++ b/tildes/tildes/views/api/web/exceptions.py @@ -75,8 +75,8 @@ def error_to_text_response(request: Request) -> Response: elif isinstance(request.exception, HTTPBadRequest): if response.title == "Bad CSRF Token": response.text = "Page expired, reload and try again" - # else: - # response.text = "Unknown error" + else: + response.text = "Unknown error" return response