Order sub exile/etc listings reverse chronological.

remotes/1693176582716663532/tmp_refs/heads/watchparty
Snakes 2022-09-24 14:11:48 -04:00
parent 3ff7467fd1
commit 0a05562f8c
Signed by: Snakes
GPG Key ID: E745A82778055C7E
1 changed files with 11 additions and 5 deletions

View File

@ -5,6 +5,7 @@ from files.helpers.get import *
from files.helpers.regex import *
from files.classes import *
from .front import frontlist
from sqlalchemy import nullslast
import tldextract
@app.post("/exile/post/<pid>")
@ -197,7 +198,9 @@ def sub_exilees(v, sub):
sub = g.db.query(Sub).filter_by(name=sub.strip().lower()).one_or_none()
if not sub: abort(404)
users = g.db.query(User, Exile).join(Exile, Exile.user_id==User.id).filter_by(sub=sub.name).all()
users = g.db.query(User, Exile).join(Exile, Exile.user_id==User.id) \
.filter_by(sub=sub.name) \
.order_by(nullslast(Exile.created_utc.desc()), User.username).all()
return render_template("sub/exilees.html", v=v, sub=sub, users=users)
@ -208,20 +211,23 @@ def sub_blockers(v, sub):
sub = g.db.query(Sub).filter_by(name=sub.strip().lower()).one_or_none()
if not sub: abort(404)
users = g.db.query(User).join(SubBlock).filter_by(sub=sub.name).all()
users = g.db.query(User).join(SubBlock) \
.filter_by(sub=sub.name) \
.order_by(nullslast(SubBlock.created_utc.desc()), User.username).all()
return render_template("sub/blockers.html",
v=v, sub=sub, users=users, verb="blocking")
@app.get("/h/<sub>/followers")
@auth_required
def sub_followers(v, sub):
sub = g.db.query(Sub).filter_by(name=sub.strip().lower()).one_or_none()
if not sub: abort(404)
users = g.db.query(User) \
.join(SubSubscription) \
.filter_by(sub=sub.name).all()
users = g.db.query(User).join(SubSubscription) \
.filter_by(sub=sub.name) \
.order_by(nullslast(SubSubscription.created_utc.desc()), User.username).all()
return render_template("sub/blockers.html",
v=v, sub=sub, users=users, verb="following")