forked from rDrama/rDrama
add /blockers (thx JC <3)
parent
340f9e31fe
commit
ebf83048be
|
@ -899,19 +899,15 @@ def user_id(id):
|
|||
def redditor_moment_redirect(username, v):
|
||||
return redirect(f"/@{username}")
|
||||
|
||||
@app.get("/@<username>/followers")
|
||||
@app.get("/@<username>/blockers")
|
||||
@auth_required
|
||||
def followers(username, v):
|
||||
def blockers(username, v):
|
||||
u = get_user(username, v=v)
|
||||
if u.id == CARP_ID: abort(403)
|
||||
|
||||
if not (v.id == u.id or v.admin_level >= PERMS['USER_FOLLOWS_VISIBLE']):
|
||||
abort(403)
|
||||
|
||||
users = g.db.query(Follow, User).join(Follow, Follow.target_id == u.id) \
|
||||
.filter(Follow.user_id == User.id) \
|
||||
.order_by(Follow.created_utc).all()
|
||||
return render_template("followers.html", v=v, u=u, users=users)
|
||||
users = g.db.query(UserBlock, User).join(UserBlock, UserBlock.target_id == u.id) \
|
||||
.filter(UserBlock.user_id == User.id) \
|
||||
.order_by(UserBlock.created_utc).all()
|
||||
return render_template("blockers.html", v=v, u=u, users=users)
|
||||
|
||||
@app.get("/@<username>/following")
|
||||
@auth_required
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
{% extends "default.html" %}
|
||||
{% block content %}
|
||||
<pre>
|
||||
|
||||
|
||||
</pre>
|
||||
<h5>@{{u.username}}'s blockers</h5>
|
||||
<pre></pre>
|
||||
<div class="overflow-x-auto"><table class="table table-striped mb-5">
|
||||
<thead class="bg-primary text-white">
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Name</th>
|
||||
<td>Blocking Since</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="blockers-table">
|
||||
{% for block, user in users %}
|
||||
<tr>
|
||||
<td>{{loop.index}}</td>
|
||||
<td>{% include "user_in_table.html" %}</td>
|
||||
<td {% if block.created_utc > 1599343262 %}data-time="{{block.created_utc}}"{% endif %}></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<script defer src="/assets/js/blockers.js?v=4000"></script>
|
||||
|
||||
{% endblock %}
|
|
@ -384,7 +384,7 @@
|
|||
<tr {% if v.id == user.id %}class="self"{% endif %}>
|
||||
<td>{{loop.index}}</td>
|
||||
<td>{% include "user_in_table.html" %}</td>
|
||||
<td><a href="/blockers/{{user.id}}">{{"{:,}".format(num)}}</a></td>
|
||||
<td><a href="/@{{user.username}}/blockers">{{"{:,}".format(num)}}</a></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% if pos16 and (pos16[0] > 25 or not pos16[1]) %}
|
||||
|
@ -395,7 +395,7 @@
|
|||
{% include "user_in_table.html" %}
|
||||
{% endwith %}
|
||||
</td>
|
||||
<td><a href="/blockers/{{v.id}}">{{"{:,}".format(pos16[1])}}</a></td>
|
||||
<td><a href="/@{{v.username}}/blockers">{{"{:,}".format(pos16[1])}}</a></td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
</table>
|
||||
|
|
Loading…
Reference in New Issue