make so it post subscription only give notifs to top-level comments

master
Aevann1 2022-06-22 20:05:56 +02:00
parent ebdda8c412
commit f6bb11bdc2
1 changed files with 5 additions and 3 deletions

View File

@ -186,6 +186,8 @@ def api_comment(v):
parent = parent_post parent = parent_post
parent_comment_id = None parent_comment_id = None
level = 1 level = 1
if POLL_THREAD and parent.id == POLL_THREAD and v.admin_level < 2: abort(403)
elif parent_fullname.startswith("t3_"): elif parent_fullname.startswith("t3_"):
parent = get_comment(parent_fullname.split("_")[1], v=v) parent = get_comment(parent_fullname.split("_")[1], v=v)
parent_comment_id = parent.id parent_comment_id = parent.id
@ -193,8 +195,6 @@ def api_comment(v):
if parent.author_id == v.id: rts = True if parent.author_id == v.id: rts = True
else: abort(400) else: abort(400)
if POLL_THREAD and parent_post.id == POLL_THREAD and v.admin_level < 2: abort(403)
body = request.values.get("body", "").strip()[:10000] body = request.values.get("body", "").strip()[:10000]
if parent_post.id not in ADMIGGERS: if parent_post.id not in ADMIGGERS:
@ -583,7 +583,9 @@ def api_comment(v):
if not v.shadowbanned: if not v.shadowbanned:
notify_users = NOTIFY_USERS(body, v) notify_users = NOTIFY_USERS(body, v)
for x in g.db.query(Subscription.user_id).filter_by(submission_id=c.parent_submission).all(): notify_users.add(x[0]) if c.level == 1:
for x in g.db.query(Subscription.user_id).filter_by(submission_id=c.parent_submission).all():
notify_users.add(x[0])
if parent.author.id != v.id: if parent.author.id != v.id:
notify_users.add(parent.author.id) notify_users.add(parent.author.id)