show follow time

master
Aevann1 2022-09-05 23:52:56 +02:00
parent de46a6e519
commit c15e0f6fad
2 changed files with 6 additions and 2 deletions

View File

@ -879,10 +879,12 @@ def redditor_moment_redirect(username, v):
@auth_required
def followers(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(User).join(Follow, Follow.target_id == u.id) \
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)

View File

@ -11,16 +11,18 @@
<tr>
<th>#</th>
<th>Name</th>
<td>Following Since</td>
{% if v.id == u.id %}
<th></th>
{% endif %}
</tr>
</thead>
<tbody id="followers-table">
{% for user in users %}
{% for follow, user in users %}
<tr>
<td>{{loop.index}}</td>
<td>{% include "user_in_table.html" %}</td>
<td data-time="{{follow.created_utc}}"></td>
{% if v.id == u.id %}
<td><div class="btn btn-danger pr-2" onclick="removeFollower(event, '{{user.username}}')">Remove follow</div></td>
{% endif %}