diff --git a/files/routes/front.py b/files/routes/front.py index 9d92becfe6..8f4aec61dd 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -9,7 +9,7 @@ defaulttimefilter = environ.get("DEFAULT_TIME_FILTER", "all").strip() @app.post("/clear") @auth_required def clear(v): - notifs = g.db.query(Notification).join(Comment, Notification.comment_id == Comment.id).filter(Notification.read == False, Notification.user_id == v.id).all() + notifs = g.db.query(Notification).join(Comment).filter(Notification.read == False, Notification.user_id == v.id).all() for n in notifs: n.read = True g.db.add(n) @@ -19,7 +19,7 @@ def clear(v): @app.get("/unread") @auth_required def unread(v): - listing = g.db.query(Notification, Comment).join(Comment, Notification.comment_id == Comment.id).filter( + listing = g.db.query(Notification, Comment).join(Comment).filter( Notification.read == False, Notification.user_id == v.id, Comment.is_banned == False, @@ -38,6 +38,7 @@ def unread(v): @app.get("/notifications") @auth_required def notifications(v): + sex = time.time() t = time.time() try: page = int(request.values.get('page', 1)) except: page = 1 @@ -54,7 +55,7 @@ def notifications(v): next_exists = (len(comments) > 25) listing = comments[:25] elif posts: - notifications = g.db.query(Notification, Comment).join(Comment, Notification.comment_id == Comment.id).filter(Notification.user_id == v.id, Comment.author_id == AUTOJANNY_ID).order_by(Notification.created_utc.desc()).offset(25 * (page - 1)).limit(101).all() + notifications = g.db.query(Notification, Comment).join(Comment).filter(Notification.user_id == v.id, Comment.author_id == AUTOJANNY_ID).order_by(Notification.created_utc.desc()).offset(25 * (page - 1)).limit(101).all() listing = [] @@ -72,7 +73,7 @@ def notifications(v): next_exists = (len(notifications) > len(listing)) elif reddit: - notifications = g.db.query(Notification, Comment).join(Comment, Notification.comment_id == Comment.id).filter(Notification.user_id == v.id, Comment.body_html.like('

New rdrama mention: len(listing)) else: - unread = g.db.query(Notification, Comment).join(Comment, Notification.comment_id == Comment.id).filter( - Notification.read == False, - Notification.user_id == v.id, - Comment.author_id != AUTOJANNY_ID, - Comment.body_html.notlike('

New rdrama mention: 25) comments = comments[:25] - cids = set([x[0] for x in g.db.query(Comment.id).join(Notification).filter( + all = g.db.query(Comment).join(Notification, Notification.comment_id == Comment.id).filter( Notification.user_id == v.id, Comment.is_banned == False, Comment.deleted_utc == 0, Comment.author_id != AUTOJANNY_ID, - Comment.body_html.notlike('

New rdrama mention: