From 0c6e3fd120bd3b66bf71710711019a09c30bdd93 Mon Sep 17 00:00:00 2001 From: raven Date: Mon, 2 Nov 2026 04:14:52 -0600 Subject: prevent deleting the wiki body, which is problematic --- apioforum/templates/common.html | 2 +- apioforum/thread.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/apioforum/templates/common.html b/apioforum/templates/common.html index be7b6ee..c731180 100644 --- a/apioforum/templates/common.html +++ b/apioforum/templates/common.html @@ -44,7 +44,7 @@ edit {% endif %} - {% if post.author == g.user or (forum and has_permission(forum, g.user, "p_delete_posts")) %} + {% if post.wiki != 1 and (post.author == g.user or (forum and has_permission(forum, g.user, "p_delete_posts"))) %} delete {% endif %} diff --git a/apioforum/thread.py b/apioforum/thread.py index 9b74347..b679b2a 100644 --- a/apioforum/thread.py +++ b/apioforum/thread.py @@ -310,6 +310,9 @@ def delete_post(post_id): return redirect("/") jump_url = post_jump(post_id) + if post['wiki'] == 1: + flash("cannot delete wiki post") + return redirect(jump_url) if post['author'] != g.user and not has_permission(thread['forum'], g.user, "p_delete_posts"): flash("you do not have permission to do that") return redirect(jump_url) -- cgit v1.2.3