forked from MarseyWorld/MarseyWorld
make blocks faster and order it by most recent
parent
fb0aed8e2b
commit
04a3e3922a
|
@ -341,17 +341,9 @@ def badges(v):
|
||||||
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400, key_func=get_ID)
|
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400, key_func=get_ID)
|
||||||
@admin_level_required(PERMS['USER_BLOCKS_VISIBLE'])
|
@admin_level_required(PERMS['USER_BLOCKS_VISIBLE'])
|
||||||
def blocks(v):
|
def blocks(v):
|
||||||
blocks=g.db.query(UserBlock).all()
|
blocks = g.db.query(UserBlock).order_by(UserBlock.created_utc.desc()).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)
|
|
||||||
|
|
||||||
return render_template("blocks.html", v=v, users=users, targets=targets)
|
return render_template("blocks.html", v=v, blocks=blocks)
|
||||||
|
|
||||||
@app.get("/formatting")
|
@app.get("/formatting")
|
||||||
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400)
|
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400)
|
||||||
|
|
|
@ -5,16 +5,22 @@
|
||||||
<div class="overflow-x-auto mt-3"><table class="table table-striped mb-5">
|
<div class="overflow-x-auto mt-3"><table class="table table-striped mb-5">
|
||||||
<thead class="bg-primary text-white">
|
<thead class="bg-primary text-white">
|
||||||
<tr>
|
<tr>
|
||||||
<th>#</th>
|
|
||||||
<th>User</th>
|
<th>User</th>
|
||||||
<th>Target</th>
|
<th>Target</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
{% for user in users %}
|
{% for block in blocks %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{loop.index}}</td>
|
<td>
|
||||||
<td><a style="font-weight:bold;color:#{{user.name_color}}" href="/@{{user.username}}"><span {% if user.patron %}class="patron" style="background-color:#{{user.name_color}}"{% endif %}>{{user.user_name}}</span></a></td>
|
{% with user = block.user %}
|
||||||
<td><a style="font-weight:bold;color:#{{targets[loop.index-1].name_color}}" href="/@{{targets[loop.index-1].username}}"><span {% if targets[loop.index-1].patron %}class="patron" style="background-color:#{{targets[loop.index-1].name_color}}"{% endif %}>{{targets[loop.index-1].user_name}}</span></a></td>
|
{% include "user_in_table.html" %}
|
||||||
|
{% endwith %}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{% with user = block.target %}
|
||||||
|
{% include "user_in_table.html" %}
|
||||||
|
{% endwith %}
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
|
Loading…
Reference in New Issue