show duration on ban icon tooltip

remotes/1693045480750635534/spooky-22
Aevann1 2022-06-25 02:11:00 +02:00
parent d59a80245d
commit ffd0d9ed31
8 changed files with 16 additions and 20 deletions

View File

@ -51,7 +51,7 @@ class Comment(Base):
edited_utc = Column(Integer, default=0)
is_banned = Column(Boolean, default=False)
ghost = Column(Boolean, default=False)
bannedfor = Column(Boolean)
bannedfor = Column(String)
distinguish_level = Column(Integer, default=0)
deleted_utc = Column(Integer, default=0)
is_approved = Column(Integer, ForeignKey("users.id"))

View File

@ -40,7 +40,7 @@ class Submission(Base):
created_utc = Column(Integer)
thumburl = Column(String)
is_banned = Column(Boolean, default=False)
bannedfor = Column(Boolean)
bannedfor = Column(String)
ghost = Column(Boolean, default=False)
views = Column(Integer, default=0)
deleted_utc = Column(Integer, default=0)

View File

@ -1110,19 +1110,15 @@ def ban_user(user_id, v):
if 'reason' in request.values:
if request.values["reason"].startswith("/post/"):
try:
post = int(request.values["reason"].split("/post/")[1].split(None, 1)[0])
post = get_post(post)
post.bannedfor = True
g.db.add(post)
except: pass
post = int(request.values["reason"].split("/post/")[1].split(None, 1)[0])
post = get_post(post)
post.bannedfor = duration
g.db.add(post)
elif request.values["reason"].startswith("/comment/"):
try:
comment = int(request.values["reason"].split("/comment/")[1].split(None, 1)[0])
comment = get_comment(comment)
comment.bannedfor = True
g.db.add(comment)
except: pass
comment = int(request.values["reason"].split("/comment/")[1].split(None, 1)[0])
comment = get_comment(comment)
comment.bannedfor = duration
g.db.add(comment)
notify_mod_action(v.id, f"@{v.username} has banned @{user.username} ({note})")
g.db.commit()

View File

@ -1,5 +1,5 @@
<script src="/assets/js/ban_modal.js?v=241"></script>
<script src="/assets/js/ban_modal.js?v=242"></script>
<div class="modal fade" id="banModal" tabindex="-1" role="dialog" aria-labelledby="banModalTitle" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">

View File

@ -184,7 +184,7 @@
{% endif %}
{% if c.bannedfor %}
<a role="button"><i class="fas fa-hammer-crash text-danger" data-bs-toggle="tooltip" data-bs-placement="bottom" title="User was banned for this comment{% if c.author.banned_by %} by @{{c.author.banned_by.username}}{% endif %}"></i></a>
<i class="fas fa-hammer-crash text-danger" data-bs-toggle="tooltip" data-bs-placement="bottom" title="User was banned for this comment{% if c.author.banned_by %} by @{{c.author.banned_by.username}}{% endif %} for {{c.bannedfor}}"></i>
{% endif %}
{% if c.active_flags(v) %}<a class="btn btn-primary" style="padding:1px 5px; font-size:10px"role="button" onclick="document.getElementById('flaggers-{{c.id}}').classList.toggle('d-none')">{{c.active_flags(v)}} Report{{ help.plural(c.active_flags(v)) }}</a>{% endif %}
{% if c.over_18 %}<span class="badge badge-danger text-small-extra mr-1">+18</span>{% endif %}

View File

@ -713,7 +713,7 @@
{% endif %}
{% if p.bannedfor %}
<a role="button"><i class="fas fa-hammer-crash text-danger" data-bs-toggle="tooltip" data-bs-placement="bottom" title="User was banned for this post{% if p.author.banned_by %} by @{{p.author.banned_by.username}}{% endif %}"></i></a>
<i class="fas fa-hammer-crash text-danger" data-bs-toggle="tooltip" data-bs-placement="bottom" title="User was banned for this post{% if p.author.banned_by %} by @{{p.author.banned_by.username}}{% endif %} for {{p.bannedfor}}"></i>
{% endif %}
{% for a in p.awards|reverse %}

View File

@ -156,7 +156,7 @@
{% endif %}
{% if p.bannedfor %}
<a role="button"><i class="fas fa-hammer-crash text-danger" data-bs-toggle="tooltip" data-bs-placement="bottom" title="User was banned for this post{% if p.author.banned_by %} by @{{p.author.banned_by.username}}{% endif %}"></i></a>
<i class="fas fa-hammer-crash text-danger" data-bs-toggle="tooltip" data-bs-placement="bottom" title="User was banned for this post{% if p.author.banned_by %} by @{{p.author.banned_by.username}}{% endif %} for {{p.bannedfor}}"></i>
{% endif %}
{% for a in p.awards|reverse %}

View File

@ -84,7 +84,7 @@ CREATE TABLE public.submissions (
private boolean DEFAULT false NOT NULL,
views integer DEFAULT 0 NOT NULL,
is_bot boolean DEFAULT false NOT NULL,
bannedfor boolean,
bannedfor character varying(11),
comment_count integer DEFAULT 0 NOT NULL,
club boolean DEFAULT false NOT NULL,
stickied character varying(40),
@ -273,7 +273,7 @@ CREATE TABLE public.comments (
is_bot boolean DEFAULT false NOT NULL,
app_id integer,
sentto integer,
bannedfor boolean,
bannedfor character varying(11),
stickied character varying(40),
body character varying(10000),
body_html character varying(40000),