fd
This commit is contained in:
parent
f8b96e5877
commit
c79023fc53
6 changed files with 27 additions and 1 deletions
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
||||
|
|
|
@ -116,6 +116,11 @@
|
|||
<i class="{{a.class_list}} px-1" data-toggle="tooltip" data-placement="bottom" title="{{a.title}} Award given by @{{a.user.username}}"></i>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% if c.bannedforit %}
|
||||
<a href="javascript:void(0)"><i class="fad fa-gavel text-danger" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="User was banned for this comment by @{{c.author.banned_by.username}}"></i></a>
|
||||
{% endif %}
|
||||
|
||||
{% if c.active_flags %} <a class="btn btn-primary" style="padding:1px 5px; font-size:10px;" href="javascript:void(0)" onclick="document.getElementById('flaggers-{{c.id}}').classList.toggle('d-none')">{{c.active_flags}} Reports</a> {% endif %}
|
||||
{% if c.over_18 %}<span class="badge badge-danger text-small-extra mr-1">+18</span> {% endif %}
|
||||
{% if v and v.admin_level==6 and c.author.shadowbanned %}<i class="fas fa-user-times text-admin" data-toggle="tooltip" data-placement="bottom" title="Shadowbanned user"></i> {% endif %}
|
||||
|
|
|
@ -207,6 +207,10 @@
|
|||
<div class="{% if p.deleted_utc > 0 %}deleted {% endif %}card-block w-100 my-md-auto">
|
||||
|
||||
<div class="post-meta text-left mb-2">
|
||||
{% if p.bannedforit %}
|
||||
<a href="javascript:void(0)"><i class="fad fa-gavel text-danger" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="User was banned for this comment by @{{p.author.banned_by.username}}"></i></a>
|
||||
{% endif %}
|
||||
|
||||
{% if p.awards %}
|
||||
{% for a in p.awards[:5] %}
|
||||
<i class="{{a.class_list}} px-1" data-toggle="tooltip" data-placement="bottom" title="{{a.title}} Award given by @{{a.user.username}}"></i>
|
||||
|
|
|
@ -86,6 +86,10 @@
|
|||
<div class="card-block text-left x-scroll-parent my-md-auto w-100">
|
||||
|
||||
<div class="post-meta text-left x-scroll mb-md-2">
|
||||
{% if p.bannedforit %}
|
||||
<a href="javascript:void(0)"><i class="fad fa-gavel text-danger" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="User was banned for this comment by @{{p.author.banned_by.username}}"></i></a>
|
||||
{% endif %}
|
||||
|
||||
{% if p.awards %}
|
||||
{% for a in p.awards[:5] %}
|
||||
<i class="{{a.class_list}} px-1" data-toggle="tooltip" data-placement="bottom" title="{{a.title}} Award given by @{{a.user.username}}"></i>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue