From 6c0e5efae797d8f6dce0425448a037445dfadc18 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 30 Jul 2021 17:49:34 +0200 Subject: [PATCH] fdfd --- drama/classes/user.py | 1 - drama/routes/comments.py | 31 ------------------------------- drama/routes/posts.py | 30 ------------------------------ drama/templates/comments.html | 8 -------- 4 files changed, 70 deletions(-) diff --git a/drama/classes/user.py b/drama/classes/user.py index b429f5c287..dc00ad58d6 100644 --- a/drama/classes/user.py +++ b/drama/classes/user.py @@ -36,7 +36,6 @@ class User(Base, Stndrd, Age_times): passhash = deferred(Column(String)) post_count = Column(Integer, default=0) comment_count = Column(Integer, default=0) - banawards = Column(Integer, default=0) created_utc = Column(Integer, default=0) suicide_utc = Column(Integer, default=0) rent_utc = Column(Integer, default=0) diff --git a/drama/routes/comments.py b/drama/routes/comments.py index 302e660972..d8f0950f28 100644 --- a/drama/routes/comments.py +++ b/drama/routes/comments.py @@ -19,37 +19,6 @@ beams_client = PushNotifications( secret_key=PUSHER_KEY, ) -@app.route("/banaward/comment/", methods=["POST", "GET"]) -@auth_required -def banawardcomment(comment_id, v): - - if not v.banawards > 0: return render_template("errors/banaward.html", v=v) - - comment = g.db.query(Comment).filter_by(id=comment_id).first() - if not comment: abort(400) - u = comment.author - if u.admin_level > 0: return jsonify({"error": "You can't ban admins."}), 403 - - u.ban(admin=v, reason="1 day ban award", days=1) - send_notification(1046, u, f"Your Drama account has been suspended for 1 day for the following reason:\n\n> 1 day ban award") - - ma=ModAction( - kind="exile_user", - user_id=v.id, - target_user_id=u.id, - note=f'reason: "1 day ban award", duration: 1 day' - ) - g.db.add(ma) - - v.banawards -= 1 - g.db.add(v) - - comment.banaward = v.username - g.db.add(comment) - - return jsonify({"message": "User banned successfully!"}), 204 - - @app.get("/api/v1/post//comment/") def comment_cid_api_redirect(cid=None, pid=None): redirect(f'/api/v1/comment/') diff --git a/drama/routes/posts.py b/drama/routes/posts.py index 131e8827e1..d283fc2130 100644 --- a/drama/routes/posts.py +++ b/drama/routes/posts.py @@ -22,36 +22,6 @@ from .front import frontlist with open("snappy.txt", "r") as f: snappyquotes = f.read().split("{[para]}") -@app.route("/banaward/post/") -@auth_required -def postbanaward(post_id, v): - - if not v.banawards > 0: return render_template("errors/banaward.html", v=v) - - post = g.db.query(Submission).filter_by(id=post_id).first() - if not post: abort(400) - u = post.author - if u.admin_level > 0: return jsonify({"error": "You can't ban admins."}), 403 - - u.ban(admin=v, reason="1 day ban award", days=1) - send_notification(1046, u, f"Your Drama account has been suspended for 1 day for the following reason:\n\n> 1 day ban award") - - ma=ModAction( - kind="exile_user", - user_id=v.id, - target_user_id=u.id, - note=f'reason: "1 day ban award", duration: 1 day' - ) - g.db.add(ma) - - v.banawards -= 1 - g.db.add(v) - - post.banaward = v.username - g.db.add(post) - - return jsonify({"message": "User banned successfully!"}), 204 - @app.post("/api/publish/") @is_not_banned @validate_formkey diff --git a/drama/templates/comments.html b/drama/templates/comments.html index 2a0923d262..f1fcafdc34 100644 --- a/drama/templates/comments.html +++ b/drama/templates/comments.html @@ -410,14 +410,6 @@
  • Votes
  • - {% if v and v.id!=c.author_id and v.admin_level == 0 %} - {% if v.banawards > 0 %} -
  • Give ban award
  • - {% else %} -
  • Give ban award
  • - {% endif %} - {% endif %} - {% if v and c.id in v.saved_comment_idlist() %}
  • Unsave
  • {% else %}