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 @auth_required
def followers(username, v): def followers(username, v):
u = get_user(username, v=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']): if not (v.id == u.id or v.admin_level >= PERMS['USER_FOLLOWS_VISIBLE']):
abort(403) 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) \ .filter(Follow.user_id == User.id) \
.order_by(Follow.created_utc).all() .order_by(Follow.created_utc).all()
return render_template("followers.html", v=v, u=u, users=users) return render_template("followers.html", v=v, u=u, users=users)

View File

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