fdfd
This commit is contained in:
parent
b592c05d67
commit
4ceac0f5a1
4 changed files with 0 additions and 70 deletions
|
@ -36,7 +36,6 @@ class User(Base, Stndrd, Age_times):
|
||||||
passhash = deferred(Column(String))
|
passhash = deferred(Column(String))
|
||||||
post_count = Column(Integer, default=0)
|
post_count = Column(Integer, default=0)
|
||||||
comment_count = Column(Integer, default=0)
|
comment_count = Column(Integer, default=0)
|
||||||
banawards = Column(Integer, default=0)
|
|
||||||
created_utc = Column(Integer, default=0)
|
created_utc = Column(Integer, default=0)
|
||||||
suicide_utc = Column(Integer, default=0)
|
suicide_utc = Column(Integer, default=0)
|
||||||
rent_utc = Column(Integer, default=0)
|
rent_utc = Column(Integer, default=0)
|
||||||
|
|
|
@ -19,37 +19,6 @@ beams_client = PushNotifications(
|
||||||
secret_key=PUSHER_KEY,
|
secret_key=PUSHER_KEY,
|
||||||
)
|
)
|
||||||
|
|
||||||
@app.route("/banaward/comment/<comment_id>", 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/<pid>/comment/<cid>")
|
@app.get("/api/v1/post/<pid>/comment/<cid>")
|
||||||
def comment_cid_api_redirect(cid=None, pid=None):
|
def comment_cid_api_redirect(cid=None, pid=None):
|
||||||
redirect(f'/api/v1/comment/<cid>')
|
redirect(f'/api/v1/comment/<cid>')
|
||||||
|
|
|
@ -22,36 +22,6 @@ from .front import frontlist
|
||||||
with open("snappy.txt", "r") as f:
|
with open("snappy.txt", "r") as f:
|
||||||
snappyquotes = f.read().split("{[para]}")
|
snappyquotes = f.read().split("{[para]}")
|
||||||
|
|
||||||
@app.route("/banaward/post/<post_id>")
|
|
||||||
@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/<pid>")
|
@app.post("/api/publish/<pid>")
|
||||||
@is_not_banned
|
@is_not_banned
|
||||||
@validate_formkey
|
@validate_formkey
|
||||||
|
|
|
@ -410,14 +410,6 @@
|
||||||
|
|
||||||
<li class="list-group-item"><a href="/votes?link=https://rdrama.net{{c.permalink}}"><i class="fas fa-arrows-v"></i>Votes</a></li>
|
<li class="list-group-item"><a href="/votes?link=https://rdrama.net{{c.permalink}}"><i class="fas fa-arrows-v"></i>Votes</a></li>
|
||||||
|
|
||||||
{% if v and v.id!=c.author_id and v.admin_level == 0 %}
|
|
||||||
{% if v.banawards > 0 %}
|
|
||||||
<li class="list-group-item"><a href="javascript:void(0)" onclick="post_toast('/banaward/comment/{{c.id}}')"><i class="fas fa-user-slash text-danger"></i>Give ban award</a></li>
|
|
||||||
{% else %}
|
|
||||||
<li class="list-group-item"><a href="/banaward/comment/{{c.id}}"><i class="fas fa-user-slash text-danger"></i>Give ban award</a></li>
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if v and c.id in v.saved_comment_idlist() %}
|
{% if v and c.id in v.saved_comment_idlist() %}
|
||||||
<li class="list-group-item"><a href="javascript:void(0)" onclick="post('/unsave_comment/{{c.id}}', function(){window.location.reload(true);})"><i class="fas fa-save"></i>Unsave</a></li>
|
<li class="list-group-item"><a href="javascript:void(0)" onclick="post('/unsave_comment/{{c.id}}', function(){window.location.reload(true);})"><i class="fas fa-save"></i>Unsave</a></li>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue