diff --git a/files/routes/static.py b/files/routes/static.py index f22ca7db6..fb43b4d46 100644 --- a/files/routes/static.py +++ b/files/routes/static.py @@ -341,17 +341,9 @@ def badges(v): @limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400, key_func=get_ID) @admin_level_required(PERMS['USER_BLOCKS_VISIBLE']) def blocks(v): - blocks=g.db.query(UserBlock).all() - users = [] - targets = [] - for x in blocks: - acc_user = get_account(x.user_id) - acc_tgt = get_account(x.target_id) - if acc_user.shadowbanned or acc_tgt.shadowbanned: continue - users.append(acc_user) - targets.append(acc_tgt) + blocks = g.db.query(UserBlock).order_by(UserBlock.created_utc.desc()).all() - return render_template("blocks.html", v=v, users=users, targets=targets) + return render_template("blocks.html", v=v, blocks=blocks) @app.get("/formatting") @limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400) diff --git a/files/templates/blocks.html b/files/templates/blocks.html index eefc1c8b2..7c7cb1d99 100644 --- a/files/templates/blocks.html +++ b/files/templates/blocks.html @@ -5,16 +5,22 @@
# | User | Target | ||
---|---|---|---|---|
{{loop.index}} | -{{user.user_name}} | -{{targets[loop.index-1].user_name}} | ++ {% with user = block.user %} + {% include "user_in_table.html" %} + {% endwith %} + | ++ {% with user = block.target %} + {% include "user_in_table.html" %} + {% endwith %} + |