From 770933281cd7f6a5185551deab494eeaad8ba5fe Mon Sep 17 00:00:00 2001 From: Trim21 Date: Mon, 19 Aug 2024 22:05:12 +0800 Subject: [PATCH] fix: show nsfw change --- server/contrib.py | 6 +++--- server/templates/patch.html.jinja2 | 7 ++++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/server/contrib.py b/server/contrib.py index 0593bfc..ef2cfd5 100644 --- a/server/contrib.py +++ b/server/contrib.py @@ -43,7 +43,7 @@ class CreateSuggestion: summary: str desc: str cf_turnstile_response: str - nsfw: bool = False + nsfw: str | None = None @litestar.post("/suggest") @@ -106,8 +106,8 @@ async def suggest_api( summary = data.summary original_summary = original.summary - if original.nsfw != data.nsfw: - nsfw = data.nsfw + if original.nsfw != data.nsfw is not None: # true case + nsfw = not original.nsfw if (name is None) and (summary is None) and (infobox is None) and (nsfw is None): raise HTTPException("no changes found", status_code=400) diff --git a/server/templates/patch.html.jinja2 b/server/templates/patch.html.jinja2 index d00a45a..3161c58 100644 --- a/server/templates/patch.html.jinja2 +++ b/server/templates/patch.html.jinja2 @@ -55,6 +55,12 @@ {% endif %} + {% if patch.nsfw != None %} +
+

NSFW: {{ patch.nsfw }}

+
+ {% endif %} +
{% if patch.state == 0 %} {% if auth.allow_edit %} @@ -106,7 +112,6 @@
- {% if name_patch %}