Skip to content

Commit

Permalink
fix: show nsfw change
Browse files Browse the repository at this point in the history
  • Loading branch information
trim21 committed Aug 19, 2024
1 parent b1bbd5e commit 7709332
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 3 additions & 3 deletions server/contrib.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class CreateSuggestion:
summary: str
desc: str
cf_turnstile_response: str
nsfw: bool = False
nsfw: str | None = None


@litestar.post("/suggest")
Expand Down Expand Up @@ -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

Check failure on line 109 in server/contrib.py

View workflow job for this annotation

GitHub Actions / mypy

Non-overlapping equality check (left operand type: "bool", right operand type: "str | None")
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)
Expand Down
7 changes: 6 additions & 1 deletion server/templates/patch.html.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@
</div>
{% endif %}

{% if patch.nsfw != None %}
<div class="row">
<p>NSFW: {{ patch.nsfw }}</p>
</div>
{% endif %}

<div class="row">
{% if patch.state == 0 %}
{% if auth.allow_edit %}
Expand Down Expand Up @@ -106,7 +112,6 @@

</div>

</div>
{% if name_patch %}
<script>
(() => {
Expand Down

0 comments on commit 7709332

Please sign in to comment.