mirror of
https://git.wownero.com/lza_menace/suchwow.git
synced 2024-08-15 01:03:19 +00:00
add reject button and allow mods to delete other posts
This commit is contained in:
parent
6be72e3d4c
commit
f78e5ad065
2 changed files with 7 additions and 2 deletions
|
@ -119,12 +119,16 @@ def approve(id):
|
||||||
def delete(id):
|
def delete(id):
|
||||||
filtered = Post.filter(id=id)
|
filtered = Post.filter(id=id)
|
||||||
user = get_session_user()
|
user = get_session_user()
|
||||||
|
is_mod = is_moderator(user)
|
||||||
if filtered:
|
if filtered:
|
||||||
post = filtered.first()
|
post = filtered.first()
|
||||||
if user == post.submitter:
|
if user == post.submitter or is_mod:
|
||||||
post.delete_instance()
|
post.delete_instance()
|
||||||
flash("Deleted that shit, brah!")
|
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:
|
else:
|
||||||
flash("You can't delete a meme you don't own, brah")
|
flash("You can't delete a meme you don't own, brah")
|
||||||
return redirect(url_for("post.read", id=post.id))
|
return redirect(url_for("post.read", id=post.id))
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
<p class="subtitle">{{ post.text }}</p>
|
<p class="subtitle">{{ post.text }}</p>
|
||||||
{% if not post.approved %}
|
{% if not post.approved %}
|
||||||
<a href="{{ url_for('post.approve', id=post.id) }}"><button type="button" name="button">Approve</button></a>
|
<a href="{{ url_for('post.approve', id=post.id) }}"><button type="button" name="button">Approve</button></a>
|
||||||
|
<a href="{{ url_for('post.delete', id=post.id) }}"><button type="button" name="button">Reject</button></a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<p class="subtext">Submitted by <i><u><a href="/?submitter={{ post.submitter }}">{{ post.submitter }}</a></u></i> at <i>{{ post.timestamp }}</i></p>
|
<p class="subtext">Submitted by <i><u><a href="/?submitter={{ post.submitter }}">{{ post.submitter }}</a></u></i> at <i>{{ post.timestamp }}</i></p>
|
||||||
<br>
|
<br>
|
||||||
|
|
Loading…
Reference in a new issue