fsd
This commit is contained in:
parent
b30567affb
commit
3ca087239d
7 changed files with 21 additions and 5 deletions
|
@ -29,7 +29,7 @@ class Comment(Base):
|
||||||
distinguish_level = Column(Integer, default=0)
|
distinguish_level = Column(Integer, default=0)
|
||||||
deleted_utc = Column(Integer, default=0)
|
deleted_utc = Column(Integer, default=0)
|
||||||
is_approved = Column(Integer, ForeignKey("users.id"))
|
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"))
|
parent_comment_id = Column(Integer, ForeignKey("comments.id"))
|
||||||
top_comment_id = Column(Integer)
|
top_comment_id = Column(Integer)
|
||||||
over_18 = Column(Boolean, default=False)
|
over_18 = Column(Boolean, default=False)
|
||||||
|
|
|
@ -13,6 +13,9 @@ def create_comment(text_html, autojanny=False):
|
||||||
distinguish_level=6)
|
distinguish_level=6)
|
||||||
g.db.add(new_comment)
|
g.db.add(new_comment)
|
||||||
g.db.flush()
|
g.db.flush()
|
||||||
|
|
||||||
|
new_comment.top_comment_id = new_comment.id
|
||||||
|
|
||||||
return new_comment.id
|
return new_comment.id
|
||||||
|
|
||||||
def send_repeatable_notification(uid, text, autojanny=False):
|
def send_repeatable_notification(uid, text, autojanny=False):
|
||||||
|
|
|
@ -1007,6 +1007,9 @@ def shadowban(user_id, v):
|
||||||
)
|
)
|
||||||
g.db.add(new_comment)
|
g.db.add(new_comment)
|
||||||
g.db.flush()
|
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():
|
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)
|
notif = Notification(comment_id=new_comment.id, user_id=admin.id)
|
||||||
g.db.add(notif)
|
g.db.add(notif)
|
||||||
|
@ -1189,6 +1192,9 @@ def ban_user(user_id, v):
|
||||||
)
|
)
|
||||||
g.db.add(new_comment)
|
g.db.add(new_comment)
|
||||||
g.db.flush()
|
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():
|
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)
|
notif = Notification(comment_id=new_comment.id, user_id=admin.id)
|
||||||
g.db.add(notif)
|
g.db.add(notif)
|
||||||
|
|
|
@ -108,7 +108,7 @@ def notifications(v):
|
||||||
Comment.deleted_utc == 0,
|
Comment.deleted_utc == 0,
|
||||||
Comment.author_id != AUTOJANNY_ID,
|
Comment.author_id != AUTOJANNY_ID,
|
||||||
Comment.body_html.notlike('<html><body><p>New rdrama mention: <a href="https://old.reddit.com/r/%')
|
Comment.body_html.notlike('<html><body><p>New rdrama mention: <a href="https://old.reddit.com/r/%')
|
||||||
).order_by(Comment.top_comment_id.desc()).subquery()
|
).order_by(Comment.top_comment_id).subquery()
|
||||||
|
|
||||||
comments = g.db.query(Comment).join(sq, sq.c.id == Comment.id).order_by(Comment.id.desc()).offset(25 * (page - 1)).limit(26).all()
|
comments = g.db.query(Comment).join(sq, sq.c.id == Comment.id).order_by(Comment.id.desc()).offset(25 * (page - 1)).limit(26).all()
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ def notifications(v):
|
||||||
Comment.deleted_utc == 0,
|
Comment.deleted_utc == 0,
|
||||||
Comment.author_id != AUTOJANNY_ID,
|
Comment.author_id != AUTOJANNY_ID,
|
||||||
Comment.body_html.notlike('<html><body><p>New rdrama mention: <a href="https://old.reddit.com/r/%')
|
Comment.body_html.notlike('<html><body><p>New rdrama mention: <a href="https://old.reddit.com/r/%')
|
||||||
).order_by(Comment.top_comment_id.desc()).offset(25 * (page - 1)).limit(500).all()] + [x.id for x in comments])
|
).order_by(Comment.id.desc()).offset(25 * (page - 1)).limit(500).all()] + [x.id for x in comments])
|
||||||
|
|
||||||
comms = get_comments(list(cids), v=v)
|
comms = get_comments(list(cids), v=v)
|
||||||
|
|
||||||
|
|
|
@ -66,6 +66,9 @@ def request_api_keys(v):
|
||||||
)
|
)
|
||||||
g.db.add(new_comment)
|
g.db.add(new_comment)
|
||||||
g.db.flush()
|
g.db.flush()
|
||||||
|
|
||||||
|
new_comment.top_comment_id = new_comment.id
|
||||||
|
|
||||||
for admin in g.db.query(User).filter(User.admin_level > 2).all():
|
for admin in g.db.query(User).filter(User.admin_level > 2).all():
|
||||||
notif = Notification(comment_id=new_comment.id, user_id=admin.id)
|
notif = Notification(comment_id=new_comment.id, user_id=admin.id)
|
||||||
g.db.add(notif)
|
g.db.add(notif)
|
||||||
|
|
|
@ -312,6 +312,8 @@ def submit_contact(v):
|
||||||
)
|
)
|
||||||
g.db.add(new_comment)
|
g.db.add(new_comment)
|
||||||
g.db.flush()
|
g.db.flush()
|
||||||
|
new_comment.top_comment_id = new_comment.id
|
||||||
|
|
||||||
for admin in g.db.query(User).filter(User.admin_level > 1).all():
|
for admin in g.db.query(User).filter(User.admin_level > 1).all():
|
||||||
notif = Notification(comment_id=new_comment.id, user_id=admin.id)
|
notif = Notification(comment_id=new_comment.id, user_id=admin.id)
|
||||||
g.db.add(notif)
|
g.db.add(notif)
|
||||||
|
|
|
@ -623,12 +623,14 @@ def message2(v, username):
|
||||||
parent_submission=None,
|
parent_submission=None,
|
||||||
level=1,
|
level=1,
|
||||||
sentto=user.id,
|
sentto=user.id,
|
||||||
body_html=text_html,
|
body_html=text_html
|
||||||
)
|
)
|
||||||
g.db.add(c)
|
g.db.add(c)
|
||||||
|
|
||||||
g.db.flush()
|
g.db.flush()
|
||||||
|
|
||||||
|
c.top_comment_id = c.id
|
||||||
|
|
||||||
|
|
||||||
notif = Notification(comment_id=c.id, user_id=user.id)
|
notif = Notification(comment_id=c.id, user_id=user.id)
|
||||||
g.db.add(notif)
|
g.db.add(notif)
|
||||||
|
@ -670,7 +672,7 @@ def messagereply(v):
|
||||||
new_comment = Comment(author_id=v.id,
|
new_comment = Comment(author_id=v.id,
|
||||||
parent_submission=None,
|
parent_submission=None,
|
||||||
parent_comment_id=id,
|
parent_comment_id=id,
|
||||||
top_comment_id=parent.top_comment_id if parent.top_comment_id else parent.id,
|
top_comment_id=parent.top_comment_id,
|
||||||
level=parent.level + 1,
|
level=parent.level + 1,
|
||||||
sentto=user_id,
|
sentto=user_id,
|
||||||
body_html=text_html,
|
body_html=text_html,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue