Banned users leaderboard table: sort by latest unban #115
|
@ -182,10 +182,11 @@ def user_voted_comments(v:User, username):
|
||||||
@limiter.limit(DEFAULT_RATELIMIT, key_func=get_ID)
|
@limiter.limit(DEFAULT_RATELIMIT, key_func=get_ID)
|
||||||
@auth_required
|
@auth_required
|
||||||
def banned(v:User):
|
def banned(v:User):
|
||||||
|
# group temporary bans first and permanent bans last
|
||||||
users = g.db.query(User).filter(
|
users = g.db.query(User).filter(
|
||||||
User.is_banned != None,
|
User.is_banned != None,
|
||||||
or_(User.unban_utc == 0, User.unban_utc > time.time()),
|
or_(User.unban_utc == 0, User.unban_utc > time.time()),
|
||||||
).order_by(User.ban_reason)
|
).order_by(case((User.unban_utc > 0, 1), else_=2)).order_by(User.unban_utc)
|
||||||
if not v.can_see_shadowbanned:
|
if not v.can_see_shadowbanned:
|
||||||
users = users.filter(User.shadowbanned == None)
|
users = users.filter(User.shadowbanned == None)
|
||||||
users = users.all()
|
users = users.all()
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<th>Truescore</th>
|
<th>Truescore</th>
|
||||||
<th>Ban reason</th>
|
<th>Ban reason</th>
|
||||||
<th>Banned by</th>
|
<th>Banned by</th>
|
||||||
<th>Unban in</th>
|
<th class="disable-sort-click">Unban on</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
{% for user in users %}
|
{% for user in users %}
|
||||||
|
|
Loading…
Reference in New Issue