From 2432fcba66defe757ef11a6fe11aa7ce3df53770 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sn=C3=ADda=C5=88ov=C3=BD=20Mistr?= Date: Mon, 8 Jan 2024 18:45:11 +0100 Subject: [PATCH] built for bbc --- src/db/post.rs | 10 +++++++++- src/filters.rs | 2 +- static/style.css | 23 +---------------------- templates/action.html | 14 ++++++++------ templates/banned.html | 10 ++++++---- templates/error.html | 12 ++++-------- templates/index.html | 2 +- 7 files changed, 30 insertions(+), 43 deletions(-) diff --git a/src/db/post.rs b/src/db/post.rs index d91d82a..6af2746 100755 --- a/src/db/post.rs +++ b/src/db/post.rs @@ -355,7 +355,15 @@ impl Post { .execute(ctx.db()) .await?; - if self.thread.is_none() { + if let Some(thread) = self.thread { + query(&format!( + "UPDATE posts_{} SET replies = replies - 1 WHERE id = $1", + self.board + )) + .bind(thread) + .execute(ctx.db()) + .await?; + } else { ctx.cache().decr("total_threads", 1).await?; ctx.cache() .decr(format!("board_threads:{}", self.board), 1) diff --git a/src/filters.rs b/src/filters.rs index ddcd167..9c71e94 100644 --- a/src/filters.rs +++ b/src/filters.rs @@ -84,7 +84,7 @@ pub fn czech_plural(plurals: &str, count: impl Display) -> askama::Result -
-
Výsledek
-
+ + + + + +
Výsledek
{% if !response.is_empty() %} - {{ response|linebreaksbr|safe }} + {{ response|linebreaksbr|safe }} {% else %} Nic se nezměnilo. {% endif %} - - +
{% endblock %} diff --git a/templates/banned.html b/templates/banned.html index 3b3c419..51a0691 100644 --- a/templates/banned.html +++ b/templates/banned.html @@ -5,9 +5,10 @@ {% block content %}

Jsi trans, btw.

-
-
Máš ban!
-
+ + + + + {% endblock %} diff --git a/templates/error.html b/templates/error.html index db6e299..d2ae333 100755 --- a/templates/error.html +++ b/templates/error.html @@ -12,16 +12,12 @@

Je konec...

-
-
- Chyba {{ error_code }} -
+
Máš ban!
Byl jsi zabanován @@ -59,7 +60,8 @@ {% endif %} {% endif %} - +
+ {% if !error_message.is_empty() %} -
- {{ error_message }} -
+ {% endif %} - +
Chyba {{ error_code }}
{{ error_message }}
diff --git a/templates/index.html b/templates/index.html index f33012b..8466a4b 100755 --- a/templates/index.html +++ b/templates/index.html @@ -40,7 +40,7 @@ -