punished users listing fixes

pull/64/head
Aevann1 2022-12-10 10:23:56 +02:00
parent 0e7973a676
commit 45be6970d6
5 changed files with 28 additions and 9 deletions

View File

@ -338,8 +338,17 @@ def revert_actions(v, username):
@admin_level_required(PERMS['USER_SHADOWBAN'])
def shadowbanned(v):
users = g.db.query(User) \
.filter(User.shadowbanned != None) \
.filter(
User.shadowbanned != None,
not_(and_(
User.profileurl.startswith('/e/'),
User.customtitle==None,
User.namecolor == DEFAULT_COLOR,
User.patron == 0,
))
) \
.order_by(nullslast(User.last_active.desc())).all()
return render_template("admin/shadowbanned.html", v=v, users=users)

View File

@ -171,10 +171,15 @@ def user_voted_comments(v:User, username):
@app.get("/banned")
@auth_required
def banned(v:User):
after_30_days = int(time.time()) + 86400 * 30
users = g.db.query(User).filter(
User.is_banned > 0,
or_(User.unban_utc == 0, User.unban_utc > after_30_days),
or_(User.unban_utc == 0, User.unban_utc > time.time()),
not_(and_(
User.profileurl.startswith('/e/'),
User.customtitle==None,
User.namecolor == DEFAULT_COLOR,
User.patron == 0,
))
)
if v.admin_level >= PERMS['VIEW_LAST_ACTIVE']:
users = users.order_by(nullslast(User.last_active.desc()))
@ -188,7 +193,7 @@ def banned(v:User):
def grassed(v:User):
users = g.db.query(User).filter(
User.ban_reason.like('grass award used by @%'),
User.unban_utc > int(time.time()),
User.unban_utc > time.time(),
)
if not v.can_see_shadowbanned:
users = users.filter(User.shadowbanned == None)
@ -198,9 +203,14 @@ def grassed(v:User):
@app.get("/chuds")
@auth_required
def chuds(v:User):
after_30_days = int(time.time()) + 86400 * 30
users = g.db.query(User).filter(
or_(User.agendaposter == 1, User.agendaposter > after_30_days),
or_(User.agendaposter == 1, User.agendaposter > time.time()),
not_(and_(
User.profileurl.startswith('/e/'),
User.customtitle==None,
User.namecolor == DEFAULT_COLOR,
User.patron == 0,
))
)
if v.admin_level >= PERMS['VIEW_LAST_ACTIVE']:
users = users.order_by(nullslast(User.last_active.desc()))

View File

@ -2,7 +2,7 @@
{% block pagetitle %}Banned Users{% endblock %}
{% block content %}
<h5 class="my-4">Users who are permabanned or have more than 30 days to be unbanned</h5>
<h5 class="my-4">Banned Users</h5>
<div class="overflow-x-auto"><table class="table table-striped mb-5">
<thead class="bg-primary text-white">
<tr>

View File

@ -2,7 +2,7 @@
{% block pagetitle %}Chuds{% endblock %}
{% block content %}
<h5 class="my-4">Users who are permachudded or have more than 30 days to be unchudded</h5>
<h5 class="my-4">Chudded Users</h5>
<div class="overflow-x-auto"><table class="table table-striped mb-5">
<thead class="bg-primary text-white">
<tr>

View File

@ -72,7 +72,7 @@
{% endif %}
{% endblock %}
<div class="pt-3 {% if request.path == '/banned' or request.path == '/blocks' %}container-fluid{% else %}container{% endif %} {% if request.path in ['/leaderboard', '/paypigs', '/patrons'] %}px-0{% endif %}">
<div class="pt-3 container">
{% block content %}{% endblock %}