forked from rDrama/rDrama
1
0
Fork 0
master
Aevann1 2022-04-04 03:41:15 +02:00
parent 5868b07412
commit 83749285c5
2 changed files with 19 additions and 4 deletions

View File

@ -185,14 +185,11 @@ def api_comment(v):
if parent_fullname.startswith("t2_"):
parent = parent_post
parent_comment_id = None
top_comment_id = None
level = 1
elif parent_fullname.startswith("t3_"):
parent = get_comment(parent_fullname.split("_")[1], v=v)
parent_comment_id = parent.id
level = parent.level + 1
if level == 2: top_comment_id = parent.id
else: top_comment_id = parent.top_comment_id
if parent.author_id == v.id: rts = True
else: abort(400)
@ -397,7 +394,6 @@ def api_comment(v):
c = Comment(author_id=v.id,
parent_submission=parent_submission,
parent_comment_id=parent_comment_id,
top_comment_id=top_comment_id,
level=level,
over_18=parent_post.over_18 or request.values.get("over_18")=="true",
is_bot=is_bot,
@ -411,6 +407,9 @@ def api_comment(v):
g.db.add(c)
g.db.flush()
if c.level == 1: c.top_comment_id = c.id
else: c.top_comment_id = parent.top_comment_id
for option in options:
c_option = Comment(author_id=AUTOPOLLER_ID,
parent_submission=parent_submission,

View File

@ -543,6 +543,8 @@ def edit_post(pid, v):
g.db.add(c_jannied)
g.db.flush()
c_jannied.top_comment_id = c_jannied.id
n = Notification(comment_id=c_jannied.id, user_id=v.id)
g.db.add(n)
@ -725,6 +727,9 @@ def thumbnail_thread(pid):
db.add(new_comment)
db.flush()
new_comment.top_comment_id = new_comment.id
admins = db.query(User).filter(User.admin_level > 0).all()
for admin in admins:
notif = Notification(comment_id=new_comment.id, user_id=admin.id)
@ -751,6 +756,9 @@ def thumbnail_thread(pid):
db.add(new_comment)
db.flush()
new_comment.top_comment_id = new_comment.id
notif = Notification(comment_id=new_comment.id, user_id=val)
db.add(notif)
@ -777,6 +785,9 @@ def thumbnail_thread(pid):
db.add(new_comment)
db.flush()
new_comment.top_comment_id = new_comment.id
admins = db.query(User).filter(User.admin_level > 2).all()
for admin in admins:
notif = Notification(comment_id=new_comment.id, user_id=admin.id)
@ -1187,6 +1198,8 @@ def submit_post(v, sub=None):
g.db.add(c_jannied)
g.db.flush()
c_jannied.top_comment_id = c_jannied.id
n = Notification(comment_id=c_jannied.id, user_id=v.id)
g.db.add(n)
@ -1282,6 +1295,9 @@ def submit_post(v, sub=None):
check_for_slots_command(body, snappy, c)
g.db.flush()
c.top_comment_id = c.id
post.comment_count += 1
post.replies = [c]