From 7001f11be751bea41367157d09d4e5507c06165f Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Thu, 12 Aug 2021 00:26:04 +0200 Subject: [PATCH] fd --- files/classes/comment.py | 1 + files/classes/submission.py | 1 + files/routes/admin.py | 13 ++++++++++++- files/templates/comments.html | 5 +++++ files/templates/submission.html | 4 ++++ files/templates/submission_listing.html | 4 ++++ 6 files changed, 27 insertions(+), 1 deletion(-) diff --git a/files/classes/comment.py b/files/classes/comment.py index fffe6f222..0e08b2d24 100644 --- a/files/classes/comment.py +++ b/files/classes/comment.py @@ -35,6 +35,7 @@ class Comment(Base, Age_times, Scores, Stndrd, Fuzzing): created_utc = Column(Integer, default=0) edited_utc = Column(Integer, default=0) is_banned = Column(Boolean, default=False) + bannedforit = Column(Boolean) shadowbanned = Column(Boolean, default=False) distinguish_level = Column(Integer, default=0) deleted_utc = Column(Integer, default=0) diff --git a/files/classes/submission.py b/files/classes/submission.py index fe803d729..aa73fe7d6 100644 --- a/files/classes/submission.py +++ b/files/classes/submission.py @@ -42,6 +42,7 @@ class Submission(Base, Stndrd, Age_times, Scores, Fuzzing): created_utc = Column(BigInteger, default=0) thumburl = Column(String) is_banned = Column(Boolean, default=False) + bannedforit = Column(Boolean) views = Column(Integer, default=0) deleted_utc = Column(Integer, default=0) distinguish_level = Column(Integer, default=0) diff --git a/files/routes/admin.py b/files/routes/admin.py index 16fb5f045..6a7fa77c6 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -634,7 +634,18 @@ def ban_user(user_id, v): ) g.db.add(ma) - if 'reason' in request.args: return {"message": f"@{user.username} was banned!"} + if 'reason' in request.args: + if reason.startswith("/post/"): + post = reason.split("/post/")[1].split("/")[0] + post = get_post(post) + post.bannedfor = True + g.db.add(post) + elif reason.startswith("/comment/"): + comment = reason.split("/post/")[1].split("/")[0] + comment = get_comment(comment) + comment.bannedfor = True + g.db.add(comment) + return {"message": f"@{user.username} was banned!"} else: return redirect(user.url) diff --git a/files/templates/comments.html b/files/templates/comments.html index 53348f339..97231639f 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -116,6 +116,11 @@ {% endfor %} {% endif %} + + {% if c.bannedforit %} + + {% endif %} + {% if c.active_flags %} {{c.active_flags}} Reports {% endif %} {% if c.over_18 %}+18 {% endif %} {% if v and v.admin_level==6 and c.author.shadowbanned %} {% endif %} diff --git a/files/templates/submission.html b/files/templates/submission.html index ec41b8ff9..a943c4f4a 100644 --- a/files/templates/submission.html +++ b/files/templates/submission.html @@ -207,6 +207,10 @@