|
|
|
@ -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))
|
|
|
|
|