Banned users leaderboard table: sort by latest unban #115

Closed
mummified-corroding-granny wants to merge 2 commits from <deleted>:fix-banned-users-table-sorting into master
2 changed files with 3 additions and 2 deletions

View File

@ -182,10 +182,11 @@ def user_voted_comments(v:User, username):
@limiter.limit(DEFAULT_RATELIMIT, key_func=get_ID)
@auth_required
def banned(v:User):
# group temporary bans first and permanent bans last
users = g.db.query(User).filter(
User.is_banned != None,
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:
users = users.filter(User.shadowbanned == None)
users = users.all()

View File

@ -14,7 +14,7 @@
<th>Truescore</th>
<th>Ban reason</th>
<th>Banned by</th>
<th>Unban in</th>
<th class="disable-sort-click">Unban on</th>
</tr>
</thead>
{% for user in users %}