This commit is contained in:
Aevann1 2022-04-15 17:03:02 +02:00
parent 7332ef0a96
commit 8c1e134132
5 changed files with 6 additions and 7 deletions

View file

@ -112,11 +112,10 @@ def notifications(v):
Comment.body_html.notlike('<html><body><p>New site mention: <a href="https://old.reddit.com/r/%')
).order_by(Comment.top_comment_id.desc(), Notification.created_utc.desc()).subquery()
comments = g.db.query(Comment).join(sq, sq.c.id == Comment.id).order_by(sq.c.created_utc.desc())
if not (v and (v.shadowbanned or v.admin_level > 1)):
comments = comments.join(User, User.id == Comment.author_id).filter(User.shadowbanned == None)
comments = comments.offset(25 * (page - 1)).limit(26).all()
if v and (v.shadowbanned or v.admin_level > 1):
comments = g.db.query(Comment).join(sq, sq.c.id == Comment.id).order_by(sq.c.created_utc.desc()).offset(25 * (page - 1)).limit(26).all()
else:
comments = g.db.query(Comment).join(sq, sq.c.id == Comment.id).join(User, User.id == Comment.author_id).filter(User.shadowbanned == None).order_by(sq.c.created_utc.desc()).offset(25 * (page - 1)).limit(26).all()
next_exists = (len(comments) > 25)
comments = comments[:25]