mirror of
https://git.wownero.com/lza_menace/suchwow.git
synced 2024-08-15 01:03:19 +00:00
only show images which are tied to approved posts
This commit is contained in:
parent
f78e5ad065
commit
d1cde8f63e
1 changed files with 8 additions and 2 deletions
|
@ -73,7 +73,7 @@ def create():
|
||||||
if file.filename == "":
|
if file.filename == "":
|
||||||
flash("You didn't upload a caliente meme, bro! You're fuckin up!")
|
flash("You didn't upload a caliente meme, bro! You're fuckin up!")
|
||||||
return redirect(request.url)
|
return redirect(request.url)
|
||||||
if post_title is "":
|
if post_title == "":
|
||||||
flash("You didn't give your meme a spicy title, bro! You're fuckin up!")
|
flash("You didn't give your meme a spicy title, bro! You're fuckin up!")
|
||||||
return redirect(request.url)
|
return redirect(request.url)
|
||||||
if file and allowed_file(file.filename):
|
if file and allowed_file(file.filename):
|
||||||
|
@ -139,4 +139,10 @@ def delete(id):
|
||||||
@bp.route("/uploads/<path:filename>")
|
@bp.route("/uploads/<path:filename>")
|
||||||
def uploaded_file(filename):
|
def uploaded_file(filename):
|
||||||
file_path = path.join(current_app.config["DATA_FOLDER"], "uploads")
|
file_path = path.join(current_app.config["DATA_FOLDER"], "uploads")
|
||||||
return send_from_directory(file_path, filename)
|
post = Post.select().where(Post.image_name==filename).first()
|
||||||
|
is_mod = is_moderator(get_session_user())
|
||||||
|
if is_mod or post.approved:
|
||||||
|
return send_from_directory(file_path, filename)
|
||||||
|
else:
|
||||||
|
flash("This image not available to view.")
|
||||||
|
return redirect(url_for("index"))
|
||||||
|
|
Loading…
Reference in a new issue