list of users u follow
This commit is contained in:
parent
ee80cda645
commit
3a874d863c
3 changed files with 50 additions and 4 deletions
|
@ -369,12 +369,17 @@ def redditor_moment_redirect(username):
|
|||
@app.get("/@<username>/followers")
|
||||
@auth_required
|
||||
def followers(username, v):
|
||||
|
||||
|
||||
u = get_user(username, v=v)
|
||||
users = [x.user for x in u.followers]
|
||||
return render_template("followers.html", v=v, u=u, users=users)
|
||||
|
||||
@app.get("/@<username>/following")
|
||||
@auth_required
|
||||
def following(username, v):
|
||||
u = get_user(username, v=v)
|
||||
users = [x.target for x in u.following]
|
||||
return render_template("following.html", v=v, u=u, users=users)
|
||||
|
||||
@app.get("/views")
|
||||
@auth_required
|
||||
def visitors(v):
|
||||
|
@ -678,7 +683,6 @@ def remove_follow(username, v):
|
|||
|
||||
return {"message": "Follower removed!"}
|
||||
|
||||
|
||||
@app.get("/uid/<id>/pic/profile")
|
||||
@limiter.exempt
|
||||
def user_profile_uid(id):
|
||||
|
|
|
@ -7,7 +7,10 @@
|
|||
table.removeChild(event.target.parentElement.parentElement);
|
||||
}
|
||||
</script>
|
||||
<pre></pre>
|
||||
<pre>
|
||||
|
||||
|
||||
</pre>
|
||||
<h5>@{{u.username}}'s followers</h5>
|
||||
<pre></pre>
|
||||
<table class="table table-striped mb-5">
|
||||
|
|
39
files/templates/following.html
Executable file
39
files/templates/following.html
Executable file
|
@ -0,0 +1,39 @@
|
|||
{% extends "default.html" %}
|
||||
{% block content %}
|
||||
<script>
|
||||
function removeFollower(event, username) {
|
||||
post_toast('/unfollow/' + username);
|
||||
let table = document.getElementById("followers-table");
|
||||
table.removeChild(event.target.parentElement.parentElement);
|
||||
}
|
||||
</script>
|
||||
<pre>
|
||||
|
||||
|
||||
</pre>
|
||||
<h5>Users followed by @{{u.username}}</h5>
|
||||
<pre></pre>
|
||||
<table class="table table-striped mb-5">
|
||||
<thead class="bg-primary text-white">
|
||||
<tr>
|
||||
<th style="font-weight: bold">#</th>
|
||||
<th style="font-weight: bold">Name</th>
|
||||
{% if v.id == u.id %}
|
||||
<th style="font-weight: bold"></th>
|
||||
{% endif %}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="followers-table">
|
||||
{% for user in users %}
|
||||
<tr>
|
||||
<td style="font-weight: bold">{{loop.index}}</td>
|
||||
<td><a style="color:#{{user.namecolor}}; font-weight:bold;" href="/@{{user.username}}"><img loading="lazy" src="/uid/{{user.id}}/pic/profile" class="profile-pic-20 mr-1"><span {% if user.patron %}class="patron" style="background-color:#{{user.namecolor}};"{% endif %}>{{user.username}}</span></a></td>
|
||||
{% if v.id == u.id %}
|
||||
<td><div class="btn btn-danger" onclick="removeFollower(event, '{{user.username}}')">Unfollow</div></td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{% endblock %}
|
Loading…
Add table
Add a link
Reference in a new issue