From f78e5ad0655384bfdb31f9d3725dc7563fc50895 Mon Sep 17 00:00:00 2001 From: lza_menace Date: Mon, 7 Dec 2020 09:29:34 -0800 Subject: [PATCH] add reject button and allow mods to delete other posts --- suchwow/routes/post.py | 8 ++++++-- suchwow/templates/post/read.html | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/suchwow/routes/post.py b/suchwow/routes/post.py index ec3cad6..372f247 100644 --- a/suchwow/routes/post.py +++ b/suchwow/routes/post.py @@ -119,12 +119,16 @@ def approve(id): def delete(id): filtered = Post.filter(id=id) user = get_session_user() + is_mod = is_moderator(user) if filtered: post = filtered.first() - if user == post.submitter: + if user == post.submitter or is_mod: post.delete_instance() flash("Deleted that shit, brah!") - return redirect(url_for("index")) + if is_mod: + return redirect(url_for("mod_queue")) + else: + return redirect(url_for("index")) else: flash("You can't delete a meme you don't own, brah") return redirect(url_for("post.read", id=post.id)) diff --git a/suchwow/templates/post/read.html b/suchwow/templates/post/read.html index b95da16..6e78c92 100644 --- a/suchwow/templates/post/read.html +++ b/suchwow/templates/post/read.html @@ -14,6 +14,7 @@

{{ post.text }}

{% if not post.approved %} + {% endif %}

Submitted by {{ post.submitter }} at {{ post.timestamp }}