diff --git a/files/classes/comment.py b/files/classes/comment.py index 6d1f79914..28a3ba076 100644 --- a/files/classes/comment.py +++ b/files/classes/comment.py @@ -29,7 +29,7 @@ class Comment(Base): distinguish_level = Column(Integer, default=0) deleted_utc = Column(Integer, default=0) is_approved = Column(Integer, ForeignKey("users.id")) - level = Column(Integer, default=0) + level = Column(Integer, default=1) parent_comment_id = Column(Integer, ForeignKey("comments.id")) top_comment_id = Column(Integer) over_18 = Column(Boolean, default=False) diff --git a/files/helpers/alerts.py b/files/helpers/alerts.py index adadbd6d2..6cdc1a781 100644 --- a/files/helpers/alerts.py +++ b/files/helpers/alerts.py @@ -13,6 +13,9 @@ def create_comment(text_html, autojanny=False): distinguish_level=6) g.db.add(new_comment) g.db.flush() + + new_comment.top_comment_id = new_comment.id + return new_comment.id def send_repeatable_notification(uid, text, autojanny=False): diff --git a/files/routes/admin.py b/files/routes/admin.py index 247c5eb7e..f06c13cda 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -1007,6 +1007,9 @@ def shadowban(user_id, v): ) g.db.add(new_comment) g.db.flush() + + new_comment.top_comment_id = new_comment.id + for admin in g.db.query(User).filter(User.admin_level > 2, User.id != v.id).all(): notif = Notification(comment_id=new_comment.id, user_id=admin.id) g.db.add(notif) @@ -1189,6 +1192,9 @@ def ban_user(user_id, v): ) g.db.add(new_comment) g.db.flush() + + new_comment.top_comment_id = new_comment.id + for admin in g.db.query(User).filter(User.admin_level > 2, User.id != v.id).all(): notif = Notification(comment_id=new_comment.id, user_id=admin.id) g.db.add(notif) diff --git a/files/routes/front.py b/files/routes/front.py index e707e81e5..2dd80b416 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -108,7 +108,7 @@ def notifications(v): Comment.deleted_utc == 0, Comment.author_id != AUTOJANNY_ID, Comment.body_html.notlike('