From b48cc5314f273324d48332e7ec8844373a4bf190 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 21 Feb 2022 03:35:01 +0200 Subject: [PATCH] bv --- files/helpers/alerts.py | 2 +- files/routes/admin.py | 8 ++++---- files/routes/front.py | 2 +- files/routes/posts.py | 6 +++--- files/routes/static.py | 2 +- files/routes/users.py | 2 +- files/templates/comments.html | 6 +++--- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/files/helpers/alerts.py b/files/helpers/alerts.py index 2ea661e70..c1d6edb23 100644 --- a/files/helpers/alerts.py +++ b/files/helpers/alerts.py @@ -93,7 +93,7 @@ def send_admin(id, body_html, vid=None): new_comment = Comment(author_id=id, parent_submission=None, level=1, - sentto=0, + sentto=2, body_html=body_html, ) g.db.add(new_comment) diff --git a/files/routes/admin.py b/files/routes/admin.py index 6c3131d46..75ebf6284 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -493,7 +493,7 @@ def under_attack(v): @app.get("/admin/badge_grant") @admin_level_required(2) def badge_grant_get(v): - badges = g.db.query(BadgeDef).all() + badges = g.db.query(BadgeDef).order_by(BadgeDef.id).all() return render_template("admin/badge_grant.html", v=v, badge_types=badges) @@ -501,7 +501,7 @@ def badge_grant_get(v): @limiter.limit("1/second;30/minute;200/hour;1000/day") @admin_level_required(2) def badge_grant_post(v): - badges = g.db.query(BadgeDef).all() + badges = g.db.query(BadgeDef).order_by(BadgeDef.id).all() user = get_user(request.values.get("username").strip(), graceful=True) if not user: @@ -546,7 +546,7 @@ def badge_grant_post(v): @app.get("/admin/badge_remove") @admin_level_required(2) def badge_remove_get(v): - badges = g.db.query(BadgeDef).all() + badges = g.db.query(BadgeDef).order_by(BadgeDef.id).all() return render_template("admin/badge_remove.html", v=v, badge_types=badges) @@ -555,7 +555,7 @@ def badge_remove_get(v): @limiter.limit("1/second;30/minute;200/hour;1000/day") @admin_level_required(2) def badge_remove_post(v): - badges = g.db.query(BadgeDef).all() + badges = g.db.query(BadgeDef).order_by(BadgeDef.id).all() user = get_user(request.values.get("username").strip(), graceful=True) if not user: diff --git a/files/routes/front.py b/files/routes/front.py index 7eaca641c..b805f2af4 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -42,7 +42,7 @@ def notifications(v): modmail = request.values.get('modmail') posts = request.values.get('posts') if modmail and v.admin_level > 1: - comments = g.db.query(Comment).filter(Comment.sentto==0).order_by(Comment.id.desc()).offset(25*(page-1)).limit(26).all() + comments = g.db.query(Comment).filter(Comment.sentto==2).order_by(Comment.id.desc()).offset(25*(page-1)).limit(26).all() next_exists = (len(comments) > 25) comments = comments[:25] elif messages: diff --git a/files/routes/posts.py b/files/routes/posts.py index fc20a8947..404244ef1 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -766,7 +766,7 @@ def thumbnail_thread(pid): body_html = sanitize(f'New {word} mention: https://old.reddit.com{i["permalink"]}?context=89', noimages=True) - existing_comment = db.query(Comment.id).filter_by(author_id=NOTIFICATIONS_ID, parent_submission=None, distinguish_level=6, body_html=body_html, level=1, sentto=0).one_or_none() + existing_comment = db.query(Comment.id).filter_by(author_id=NOTIFICATIONS_ID, parent_submission=None, distinguish_level=6, body_html=body_html, level=1, sentto=2).one_or_none() if existing_comment: break @@ -817,7 +817,7 @@ def thumbnail_thread(pid): for i in data: body_html = sanitize(f'New pcmemes mention: https://old.reddit.com{i["permalink"]}?context=89', noimages=True) - existing_comment = db.query(Comment.id).filter_by(author_id=NOTIFICATIONS_ID, parent_submission=None, distinguish_level=6, body_html=body_html, level=1, sentto=0).one_or_none() + existing_comment = db.query(Comment.id).filter_by(author_id=NOTIFICATIONS_ID, parent_submission=None, distinguish_level=6, body_html=body_html, level=1, sentto=2).one_or_none() if existing_comment: break @@ -826,7 +826,7 @@ def thumbnail_thread(pid): distinguish_level=6, body_html=body_html, level=1, - sentto=0, + sentto=2, ) db.add(new_comment) db.flush() diff --git a/files/routes/static.py b/files/routes/static.py index 1e9afc85f..abbb16e69 100644 --- a/files/routes/static.py +++ b/files/routes/static.py @@ -358,7 +358,7 @@ def robots_txt(): @app.get("/badges") @auth_required def badges(v): - badges = g.db.query(BadgeDef).all() + badges = g.db.query(BadgeDef).order_by(BadgeDef.id).all() return render_template("badges.html", v=v, badges=badges) diff --git a/files/routes/users.py b/files/routes/users.py index a4fa5f62d..9e0ddf35f 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -590,7 +590,7 @@ def messagereply(v): except: pass - if new_comment.top_comment.sentto == 0: + if new_comment.top_comment.sentto == 2: admins = g.db.query(User).filter(User.admin_level > 2, User.id != v.id, User.id != user_id).all() for admin in admins: notif = Notification(comment_id=new_comment.id, user_id=admin.id) diff --git a/files/templates/comments.html b/files/templates/comments.html index 6de947e15..024508ed6 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -157,7 +157,7 @@ {% elif c.author_id==NOTIFICATIONS_ID or c.author_id==AUTOJANNY_ID %} Notification {% else %} - {% if c.sentto == 0 %} + {% if c.sentto == 2 %} Sent to admins {% else %} Sent to @{{c.senttouser.username}} @@ -167,7 +167,7 @@ {% endif %} -{% if c.sentto and c.level > 1 and c.created_utc > 1641340623 %} +{% if c.sentto and c.level > 1 %} {% set isreply = True %} {% else %} {% set isreply = False %} @@ -639,7 +639,7 @@ {% endif %} - {% if request.path == '/notifications' and c.level == 1 and c.sentto != None and not c.parent_submission and c.author_id not in (NOTIFICATIONS_ID, AUTOJANNY_ID) %} + {% if request.path == '/notifications' and c.level == 1 and c.sentto and not c.parent_submission and c.author_id not in (NOTIFICATIONS_ID, AUTOJANNY_ID) %} Reply