From 50b6e06f6250aef12fa990a6ab1ce8c50708fc6d Mon Sep 17 00:00:00 2001 From: justcool393 Date: Thu, 16 Feb 2023 22:30:57 -0600 Subject: [PATCH] Modmail: constantify missed magic numbers --- files/routes/admin.py | 2 +- files/routes/front.py | 2 +- files/routes/oauth.py | 2 +- files/routes/static.py | 2 +- files/routes/users.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/files/routes/admin.py b/files/routes/admin.py index cf4bbb1eb..4f0e4c475 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -414,7 +414,7 @@ def change_settings(v, setting): parent_submission=None, level=1, body_html=body_html, - sentto=2, + sentto=MODMAIL_ID, distinguish_level=6 ) g.db.add(new_comment) diff --git a/files/routes/front.py b/files/routes/front.py index 9b65b4cee..4425c100e 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -51,7 +51,7 @@ def notifications(v): posts = request.values.get('posts') reddit = request.values.get('reddit') if modmail and v.admin_level > 1: - comments = g.db.query(Comment).filter(Comment.sentto==2).order_by(Comment.id.desc()).offset(25*(page-1)).limit(26).all() + comments = g.db.query(Comment).filter(Comment.sentto == MODMAIL_ID).order_by(Comment.id.desc()).offset(25*(page-1)).limit(26).all() next_exists = (len(comments) > 25) listing = comments[:25] elif messages: diff --git a/files/routes/oauth.py b/files/routes/oauth.py index 314290f0f..e684bc0cf 100644 --- a/files/routes/oauth.py +++ b/files/routes/oauth.py @@ -61,7 +61,7 @@ def request_api_keys(v): parent_submission=None, level=1, body_html=body_html, - sentto=2, + sentto=MODMAIL_ID, distinguish_level=6 ) g.db.add(new_comment) diff --git a/files/routes/static.py b/files/routes/static.py index b290f9936..40b816b2d 100644 --- a/files/routes/static.py +++ b/files/routes/static.py @@ -329,7 +329,7 @@ def submit_contact(v: Optional[User]): parent_submission=None, level=1, body_html=html, - sentto=2 + sentto=MODMAIL_ID, ) g.db.add(new_comment) g.db.flush() diff --git a/files/routes/users.py b/files/routes/users.py index b30d9d8be..f2fecf9ea 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -666,7 +666,7 @@ def messagereply(v): ) - if c.top_comment.sentto == 2: + if c.top_comment.sentto == MODMAIL_ID: admins = g.db.query(User).filter(User.admin_level > 2, User.id != v.id).all() for admin in admins: notif = Notification(comment_id=c.id, user_id=admin.id)