From d9bed378a944606ebfe0c3a23ce95fb41f083246 Mon Sep 17 00:00:00 2001 From: Aevann Date: Fri, 23 Jun 2023 16:46:42 +0300 Subject: [PATCH] complement 32fa466e6aa1df8df56a63635e5defd5c23acc4f --- files/classes/comment.py | 12 ++--- files/classes/post.py | 2 +- files/classes/user.py | 8 +-- files/helpers/actions.py | 28 +++++----- files/helpers/alerts.py | 8 +-- files/helpers/offsitementions.py | 4 +- files/helpers/sanitize.py | 8 +-- files/routes/awards.py | 2 +- files/routes/comments.py | 52 +++++++++---------- files/routes/front.py | 4 +- files/routes/notifications.py | 6 +-- files/routes/oauth.py | 2 +- files/routes/polls.py | 2 +- files/routes/posts.py | 20 +++---- files/routes/search.py | 8 +-- files/routes/static.py | 4 +- files/routes/users.py | 6 +-- files/routes/votes.py | 2 +- files/templates/comments.html | 30 +++++------ .../20230623-rename-submissions-to-posts.sql | 16 ++++++ 20 files changed, 120 insertions(+), 104 deletions(-) create mode 100644 migrations/20230623-rename-submissions-to-posts.sql diff --git a/files/classes/comment.py b/files/classes/comment.py index 8f872d29c..67b574bd6 100644 --- a/files/classes/comment.py +++ b/files/classes/comment.py @@ -72,7 +72,7 @@ def add_options(self, body, v): if v: if kind == 'post': sub = self.sub - elif self.parent_submission: + elif self.parent_post: sub = self.post.sub else: sub = None @@ -105,7 +105,7 @@ class Comment(Base): id = Column(Integer, primary_key=True) author_id = Column(Integer, ForeignKey("users.id")) - parent_submission = Column(Integer, ForeignKey("posts.id")) + parent_post = Column(Integer, ForeignKey("posts.id")) wall_user_id = Column(Integer, ForeignKey("users.id")) created_utc = Column(Integer) edited_utc = Column(Integer, default=0) @@ -203,7 +203,7 @@ class Comment(Base): @lazy def parent_fullname(self): if self.parent_comment_id: return f"c_{self.parent_comment_id}" - elif self.parent_submission: return f"p_{self.parent_submission}" + elif self.parent_post: return f"p_{self.parent_post}" @lazy def replies(self, sort, v): @@ -211,7 +211,7 @@ class Comment(Base): return self.replies2 replies = g.db.query(Comment).filter_by(parent_comment_id=self.id).order_by(Comment.stickied, Comment.stickied_child_id) - if not self.parent_submission: sort='old' + if not self.parent_post: sort='old' return sort_objects(sort, replies, Comment).all() @@ -337,7 +337,7 @@ class Comment(Base): body = add_options(self, body, v) if body: - if not (self.parent_submission and self.post.sub == 'chudrama'): + if not (self.parent_post and self.post.sub == 'chudrama'): body = censor_slurs(body, v) body = normalize_urls_runtime(body, v) @@ -371,7 +371,7 @@ class Comment(Base): if not body: return "" - if not (self.parent_submission and self.post.sub == 'chudrama'): + if not (self.parent_post and self.post.sub == 'chudrama'): body = censor_slurs(body, v).replace(':marseytrain:', ':marseytrain:') return body diff --git a/files/classes/post.py b/files/classes/post.py index 708b9fc59..a19728ebf 100644 --- a/files/classes/post.py +++ b/files/classes/post.py @@ -66,7 +66,7 @@ class Post(Base): approved_by = relationship("User", uselist=False, primaryjoin="Post.is_approved==User.id") awards = relationship("AwardRelationship", order_by="AwardRelationship.awarded_utc.desc()", back_populates="post") flags = relationship("Flag", order_by="Flag.created_utc") - comments = relationship("Comment", primaryjoin="Comment.parent_submission==Post.id", back_populates="post") + comments = relationship("Comment", primaryjoin="Comment.parent_post==Post.id", back_populates="post") subr = relationship("Sub", primaryjoin="foreign(Post.sub)==remote(Sub.name)") options = relationship("PostOption", order_by="PostOption.id") diff --git a/files/classes/user.py b/files/classes/user.py index 28ea1ea32..d76bf5aed 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -698,7 +698,7 @@ class User(Base): Notification.read == False, Comment.sentto != None, or_(Comment.author_id==self.id, Comment.sentto==self.id), - Comment.parent_submission == None, + Comment.parent_post == None, ) if not self.can_see_shadowbanned: @@ -762,7 +762,7 @@ class User(Base): Comment.created_utc > self.last_viewed_reddit_notifs, Comment.is_banned == False, Comment.deleted_utc == 0, Comment.body_html.like('%

New site mention%" in body_html: return body = random.choice(LONGPOST_REPLIES) @@ -338,8 +338,8 @@ def execute_longpostbot(c:Comment, level:int, body, body_html, post_target:post_ body_html = sanitize(body) c2 = Comment(author_id=LONGPOSTBOT_ID, - parent_submission=post_target.id if posting_to_submission else None, - wall_user_id=post_target.id if not posting_to_submission else None, + parent_post=post_target.id if posting_to_post else None, + wall_user_id=post_target.id if not posting_to_post else None, parent_comment_id=c.id, level=level+1, is_bot=True, @@ -359,13 +359,13 @@ def execute_longpostbot(c:Comment, level:int, body, body_html, post_target:post_ n = Notification(comment_id=c2.id, user_id=v.id) g.db.add(n) - if posting_to_submission: + if posting_to_post: post_target.comment_count += 3 g.db.add(post_target) push_notif({v.id}, f'New reply by @{c2.author_name}', c2.body, c2) -def execute_antispam_submission_check(title, v, url): +def execute_antispam_post_check(title, v, url): now = int(time.time()) cutoff = now - 60 * 60 * 24 diff --git a/files/helpers/alerts.py b/files/helpers/alerts.py index 378bdd2c4..988ea90a7 100644 --- a/files/helpers/alerts.py +++ b/files/helpers/alerts.py @@ -15,7 +15,7 @@ from .sanitize import * def create_comment(text_html): new_comment = Comment(author_id=AUTOJANNY_ID, - parent_submission=None, + parent_post=None, body_html=text_html, distinguish_level=6, is_bot=True) @@ -32,7 +32,7 @@ def send_repeatable_notification(uid, text): text_html = sanitize(text, blackjack="notification") - existing_comments = g.db.query(Comment.id).filter_by(author_id=AUTOJANNY_ID, parent_submission=None, body_html=text_html, is_bot=True).order_by(Comment.id).all() + existing_comments = g.db.query(Comment.id).filter_by(author_id=AUTOJANNY_ID, parent_post=None, body_html=text_html, is_bot=True).order_by(Comment.id).all() for c in existing_comments: existing_notif = g.db.query(Notification.user_id).filter_by(user_id=uid, comment_id=c.id).one_or_none() @@ -65,7 +65,7 @@ def notif_comment(text): existing = g.db.query(Comment.id).filter( Comment.author_id == AUTOJANNY_ID, - Comment.parent_submission == None, + Comment.parent_post == None, Comment.body_html == text_html, Comment.is_bot == True, ).order_by(Comment.id).all() @@ -96,7 +96,7 @@ def notif_comment2(p): search_html = f'% has mentioned you: 140: @@ -183,7 +183,7 @@ def comment(v:User): file.save(oldname) image = process_image(oldname, v) if image == "": abort(400, "Image upload failed") - if posting_to_submission and v.admin_level >= PERMS['USE_ADMIGGER_THREADS']: + if posting_to_post and v.admin_level >= PERMS['USE_ADMIGGER_THREADS']: def process_sidebar_or_banner(type, resize=0): li = sorted(os.listdir(f'files/assets/images/{SITE_NAME}/{type}'), key=lambda e: int(e.split('.webp')[0]))[-1] @@ -232,7 +232,7 @@ def comment(v:User): body = body.replace('\n ', '\n') body = body.strip()[:COMMENT_BODY_LENGTH_LIMIT] - if v.admin_level >= PERMS['USE_ADMIGGER_THREADS'] and posting_to_submission and post_target.id == SNAPPY_THREAD and level == 1 and body not in SNAPPY_QUOTES: + if v.admin_level >= PERMS['USE_ADMIGGER_THREADS'] and posting_to_post and post_target.id == SNAPPY_THREAD and level == 1 and body not in SNAPPY_QUOTES: with open(f"snappy_{SITE_NAME}.txt", "a", encoding="utf-8") as f: f.write('\n{[para]}\n' + body) @@ -247,8 +247,8 @@ def comment(v:User): Comment.author_id == v.id, Comment.deleted_utc == 0, Comment.parent_comment_id == parent_comment_id, - Comment.parent_submission == post_target.id if posting_to_submission else None, - Comment.wall_user_id == post_target.id if not posting_to_submission else None, + Comment.parent_post == post_target.id if posting_to_post else None, + Comment.wall_user_id == post_target.id if not posting_to_post else None, Comment.body_html == body_html ).first() if existing: abort(409, f"You already made that comment: /comment/{existing.id}#context") @@ -256,7 +256,7 @@ def comment(v:User): execute_antispam_comment_check(body, v) execute_antispam_duplicate_comment_check(v, body_html) - if v.marseyawarded and posting_to_submission and post_target.id not in ADMIGGER_THREADS and marseyaward_body_regex.search(body_html): + if v.marseyawarded and posting_to_post and post_target.id not in ADMIGGER_THREADS and marseyaward_body_regex.search(body_html): abort(403, "You can only type marseys!") if len(body_html) > COMMENT_BODY_HTML_LENGTH_LIMIT: @@ -264,14 +264,14 @@ def comment(v:User): is_bot = v.client is not None and v.id not in PRIVILEGED_USER_BOTS - chudded = v.chud and not (posting_to_submission and post_target.sub == 'chudrama') + chudded = v.chud and not (posting_to_post and post_target.sub == 'chudrama') c = Comment(author_id=v.id, - parent_submission=post_target.id if posting_to_submission else None, - wall_user_id=post_target.id if not posting_to_submission else None, + parent_post=post_target.id if posting_to_post else None, + wall_user_id=post_target.id if not posting_to_post else None, parent_comment_id=parent_comment_id, level=level, - over_18=post_target.over_18 if posting_to_submission else False, + over_18=post_target.over_18 if posting_to_post else False, is_bot=is_bot, app_id=v.client.application.id if v.client else None, body_html=body_html, @@ -301,8 +301,8 @@ def comment(v:User): body_jannied_html = sanitize(body) c_jannied = Comment(author_id=AUTOJANNY_ID, - parent_submission=post_target.id if posting_to_submission else None, - wall_user_id=post_target.id if not posting_to_submission else None, + parent_post=post_target.id if posting_to_post else None, + wall_user_id=post_target.id if not posting_to_post else None, distinguish_level=6, parent_comment_id=c.id, level=level+1, @@ -316,7 +316,7 @@ def comment(v:User): g.db.add(c_jannied) g.db.flush() - if posting_to_submission: + if posting_to_post: post_target.comment_count += 1 g.db.add(post_target) @@ -335,7 +335,7 @@ def comment(v:User): else: push_notif(notify_users, f'New mention of you by @{c.author_name}', c.body, c) - if c.level == 1 and posting_to_submission: + if c.level == 1 and posting_to_post: subscriber_ids = [x[0] for x in g.db.query(Subscription.user_id).filter(Subscription.post_id == post_target.id, Subscription.user_id != v.id).all()] notify_users.update(subscriber_ids) @@ -370,7 +370,7 @@ def comment(v:User): v.comment_count = g.db.query(Comment).filter( Comment.author_id == v.id, - or_(Comment.parent_submission != None, Comment.wall_user_id != None), + or_(Comment.parent_post != None, Comment.wall_user_id != None), Comment.deleted_utc == 0 ).count() g.db.add(v) @@ -382,7 +382,7 @@ def comment(v:User): # Increment post count iff not self-reply and not a spammy comment game # Essentially a measure to make comment counts reflect "real" content - if (posting_to_submission and not rts and not c.slots_result): + if (posting_to_post and not rts and not c.slots_result): post_target.comment_count += 1 g.db.add(post_target) @@ -395,8 +395,8 @@ def comment(v:User): g.db.flush() - if SITE == 'watchpeopledie.tv' and c.parent_submission: - cache.delete(f'post_{c.parent_submission}') + if SITE == 'watchpeopledie.tv' and c.parent_post: + cache.delete(f'post_{c.parent_post}') if v.client: return c.json return {"comment": render_template("comments.html", v=v, comments=[c])} @@ -418,7 +418,7 @@ def delete_comment(cid, v): v.comment_count = g.db.query(Comment).filter( Comment.author_id == v.id, - or_(Comment.parent_submission != None, Comment.wall_user_id != None), + or_(Comment.parent_post != None, Comment.wall_user_id != None), Comment.deleted_utc == 0 ).count() g.db.add(v) @@ -439,7 +439,7 @@ def undelete_comment(cid, v): cache.delete_memoized(comment_idlist) v.comment_count = g.db.query(Comment).filter( Comment.author_id == v.id, - or_(Comment.parent_submission != None, Comment.wall_user_id != None), + or_(Comment.parent_post != None, Comment.wall_user_id != None), Comment.deleted_utc == 0 ).count() g.db.add(v) @@ -607,7 +607,7 @@ def edit_comment(cid, v): abort(403, "You can't edit comments older than 1 week!") if c.author_id != v.id: abort(403) - if not c.parent_submission and not c.wall_user_id: + if not c.parent_post and not c.wall_user_id: abort(403) body = sanitize_raw_body(request.values.get("body", ""), False) diff --git a/files/routes/front.py b/files/routes/front.py index 2945867a6..6e21241e1 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -189,7 +189,7 @@ def comment_idlist(v=None, page=1, sort="new", t="day", gt=0, lt=0): .outerjoin(Comment.post) \ .options(load_only(Comment.id)) \ .filter( - or_(Comment.parent_submission != None, Comment.wall_user_id != None), + or_(Comment.parent_post != None, Comment.wall_user_id != None), ) if v.admin_level < PERMS['POST_COMMENT_MODERATION']: @@ -197,7 +197,7 @@ def comment_idlist(v=None, page=1, sort="new", t="day", gt=0, lt=0): Comment.is_banned == False, Comment.deleted_utc == 0, Comment.author_id.notin_(v.userblocks), - or_(Comment.parent_submission == None, Post.private == False), + or_(Comment.parent_post == None, Post.private == False), ) if gt: comments = comments.filter(Comment.created_utc > gt) diff --git a/files/routes/notifications.py b/files/routes/notifications.py index 511b07b0b..ae45b8f65 100644 --- a/files/routes/notifications.py +++ b/files/routes/notifications.py @@ -96,7 +96,7 @@ def notifications_messages(v:User): message_threads = g.db.query(Comment).filter( Comment.sentto != None, or_(Comment.author_id == v.id, Comment.sentto == v.id), - Comment.parent_submission == None, + Comment.parent_post == None, Comment.level == 1, ) @@ -258,7 +258,7 @@ def notifications_reddit(v:User): listing = g.db.query(Comment).filter( Comment.body_html.like('%

New site mention% threshold: break else: for comment in comments: comments2.append(comment) ids.add(comment.id) - count += g.db.query(Comment).filter_by(parent_submission=p.id, parent_comment_id=comment.id).count() + 1 + count += g.db.query(Comment).filter_by(parent_post=p.id, parent_comment_id=comment.id).count() + 1 if count > 20: break if len(comments) == len(comments2): offset = 0 @@ -203,14 +203,14 @@ def view_more(v, pid, sort, offset): if v: # shadowban check is done in sort_objects # output is needed: see comments.py - comments, output = get_comments_v_properties(v, None, Comment.parent_submission == pid, Comment.stickied == None, Comment.id.notin_(ids), Comment.level < 10) + comments, output = get_comments_v_properties(v, None, Comment.parent_post == pid, Comment.stickied == None, Comment.id.notin_(ids), Comment.level < 10) comments = comments.filter(Comment.level == 1) comments = sort_objects(sort, comments, Comment) comments = [c[0] for c in comments.all()] else: comments = g.db.query(Comment).filter( - Comment.parent_submission == pid, + Comment.parent_post == pid, Comment.level == 1, Comment.stickied == None, Comment.id.notin_(ids) @@ -226,13 +226,13 @@ def view_more(v, pid, sort, offset): for comment in comments: comments2.append(comment) ids.add(comment.id) - count += g.db.query(Comment).filter_by(parent_submission=p.id, top_comment_id=comment.id).count() + 1 + count += g.db.query(Comment).filter_by(parent_post=p.id, top_comment_id=comment.id).count() + 1 if count > 100: break else: for comment in comments: comments2.append(comment) ids.add(comment.id) - count += g.db.query(Comment).filter_by(parent_submission=p.id, parent_comment_id=comment.id).count() + 1 + count += g.db.query(Comment).filter_by(parent_post=p.id, parent_comment_id=comment.id).count() + 1 if count > 20: break if len(comments) == len(comments2): offset = 0 @@ -565,7 +565,7 @@ def submit_post(v:User, sub=None): if dup: return {"post_id": dup.id, "success": False} - if not execute_antispam_submission_check(title, v, url): + if not execute_antispam_post_check(title, v, url): return redirect("/notifications") if len(url) > 2048: @@ -684,7 +684,7 @@ def submit_post(v:User, sub=None): c_jannied = Comment(author_id=AUTOJANNY_ID, - parent_submission=p.id, + parent_post=p.id, level=1, over_18=False, is_bot=True, diff --git a/files/routes/search.py b/files/routes/search.py index 5bf51bd90..bd3a21141 100644 --- a/files/routes/search.py +++ b/files/routes/search.py @@ -199,7 +199,7 @@ def searchcomments(v:User): comments = g.db.query(Comment).options(load_only(Comment.id)).outerjoin(Comment.post) \ .filter( - or_(Comment.parent_submission != None, Comment.wall_user_id != None), + or_(Comment.parent_post != None, Comment.wall_user_id != None), Comment.author_id.notin_(v.userblocks), ) @@ -207,7 +207,7 @@ def searchcomments(v:User): if 'post' in criteria: try: post = int(criteria['post']) except: abort(404) - comments = comments.filter(Comment.parent_submission == post) + comments = comments.filter(Comment.parent_post == post) if 'author' in criteria: @@ -245,7 +245,7 @@ def searchcomments(v:User): Comment.is_banned==False, Comment.deleted_utc == 0, or_( - Comment.parent_submission.notin_(private), + Comment.parent_post.notin_(private), Comment.wall_user_id != None ) ) @@ -307,7 +307,7 @@ def searchmessages(v:User): comments = g.db.query(Comment).options(load_only(Comment.id)) \ .filter( Comment.sentto != None, - Comment.parent_submission == None, + Comment.parent_post == None, or_(*dm_conditions), ) diff --git a/files/routes/static.py b/files/routes/static.py index c27b49545..33f57aae5 100644 --- a/files/routes/static.py +++ b/files/routes/static.py @@ -269,7 +269,7 @@ def submit_contact(v): execute_antispam_duplicate_comment_check(v, body_html) new_comment = Comment(author_id=v.id, - parent_submission=None, + parent_post=None, level=1, body=body, body_html=body_html, @@ -386,7 +386,7 @@ def transfers_id(id, v): @auth_required def transfers(v:User): - comments = g.db.query(Comment).filter(Comment.author_id == AUTOJANNY_ID, Comment.parent_submission == None, Comment.body_html.like("% has transferred %")) + comments = g.db.query(Comment).filter(Comment.author_id == AUTOJANNY_ID, Comment.parent_post == None, Comment.body_html.like("% has transferred %")) page = get_page() diff --git a/files/routes/users.py b/files/routes/users.py index 87307c183..412be7b35 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -561,7 +561,7 @@ def message2(v:User, username:str): if existing: abort(403, "Message already exists!") c = Comment(author_id=v.id, - parent_submission=None, + parent_post=None, level=1, sentto=user.id, body=body, @@ -638,7 +638,7 @@ def messagereply(v:User): sentto = user_id c = Comment(author_id=v.id, - parent_submission=None, + parent_post=None, parent_comment_id=id, top_comment_id=parent.top_comment_id, level=parent.level + 1, @@ -1036,7 +1036,7 @@ def u_username_comments(username, v=None): .outerjoin(comment_post_author, Post.author) \ .filter( Comment.author_id == u.id, - or_(Comment.parent_submission != None, Comment.wall_user_id != None), + or_(Comment.parent_post != None, Comment.wall_user_id != None), ) if not v or (v.id != u.id and v.admin_level < PERMS['POST_COMMENT_MODERATION']): diff --git a/files/routes/votes.py b/files/routes/votes.py index c7c44bfce..b18079ee2 100644 --- a/files/routes/votes.py +++ b/files/routes/votes.py @@ -60,7 +60,7 @@ def vote_post_comment(target_id, new, v, cls, vote_cls): target = get_post(target_id) elif cls == Comment: target = get_comment(target_id) - if not target.parent_submission and not target.wall_user_id: abort(404) + if not target.parent_post and not target.wall_user_id: abort(404) else: abort(404) diff --git a/files/templates/comments.html b/files/templates/comments.html index 7dbbd858c..94b222a08 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -68,16 +68,16 @@ {% if standalone and level==1 %}

- {% if c.parent_submission and c.post.over_18 %} + {% if c.parent_post and c.post.over_18 %} +18 {% endif %} - {% if c.parent_submission %} + {% if c.parent_post %} {% if c.author_id==v.id and replies and is_notification_page %} Comment {{'Replies' if (replies | length)>1 else 'Reply'}}: {{c.post.realtitle(v) | safe}} {% elif c.post.author_id==v.id and c.level == 1 and is_notification_page%} Post Reply: {{c.post.realtitle(v) | safe}} - {% elif is_notification_page and c.parent_submission in v.subscribed_idlist %} + {% elif is_notification_page and c.parent_post in v.subscribed_idlist %} Subscribed Thread: {{c.post.realtitle(v) | safe}} {% elif is_notification_page %} Username Mention: {{c.post.realtitle(v) | safe}} @@ -128,7 +128,7 @@ {% endfor %} - {% if c.parent_submission %} + {% if c.parent_post %} {% set sub = c.post.sub %} {% if sub and c.author.exiled_from(sub) %} @@ -245,7 +245,7 @@
{{realbody | safe}}
- {% if c.parent_submission or c.wall_user_id %} + {% if c.parent_post or c.wall_user_id %} {% if v and v.id==c.author_id %} @@ -394,7 +394,7 @@ {% endif %} - {% if c.parent_submission or c.wall_user_id %} + {% if c.parent_post or c.wall_user_id %} {% if v and c.author_id == v.id %} @@ -425,7 +425,7 @@ {% endif %} -{% if c.parent_submission %} +{% if c.parent_post %} {% set url = "" %} {% if v.admin_level >= PERMS['POST_COMMENT_MODERATION'] %} @@ -449,7 +449,7 @@ {% endif %} -{% if c.parent_submission %} +{% if c.parent_post %} {% set sub = c.post.sub %} {% if sub and v.mods(sub) and not c.author.mods(sub) %} @@ -462,7 +462,7 @@ {% endif %} -{% if FEATURES['NSFW_MARKING'] and (c.parent_submission or c.wall_user_id) and (c.author_id==v.id or v.admin_level >= PERMS['POST_COMMENT_MODERATION'] or (c.post.sub and v.mods(c.post.sub))) %} +{% if FEATURES['NSFW_MARKING'] and (c.parent_post or c.wall_user_id) and (c.author_id==v.id or v.admin_level >= PERMS['POST_COMMENT_MODERATION'] or (c.post.sub and v.mods(c.post.sub))) %} {% endif %} @@ -491,7 +491,7 @@
{{c.body.strip()}}
{% endif %} - {% if c.parent_submission or c.wall_user_id %} + {% if c.parent_post or c.wall_user_id %} {{macros.comment_reply_box(c.fullname, "reply-to-" + c.fullname, "d-none", "collapsed child", 'reply-to-' + c.fullname, true)}} {% endif %} @@ -504,7 +504,7 @@
{% if request.path.startswith('/notifications') and replies|length > 8 %} {% for reply in replies %} - {% if reply.parent_submission %} + {% if reply.parent_post %} {% set collapse = reply.collapse %} {% else %} {% set collapse = not reply.unread and loop.index != replies|length %} @@ -521,7 +521,7 @@ {% endif %}
- {% if request.path.startswith('/notifications') and c.level == 1 and c.sentto and not c.parent_submission and c.author_id != AUTOJANNY_ID %} + {% if request.path.startswith('/notifications') and c.level == 1 and c.sentto and not c.parent_post and c.author_id != AUTOJANNY_ID %} {% if (v and v.admin_level >= PERMS['USER_BAN']) and (c.sentto == MODMAIL_ID) %} @@ -616,7 +616,7 @@ {% endif %} {% if v.admin_level < PERMS['POST_COMMENT_MODERATION'] %} - {% if c.parent_submission and v.id == c.post.author_id %} + {% if c.parent_post and v.id == c.post.author_id %} {% elif c.post.sub and v.mods(c.post.sub) %} @@ -625,7 +625,7 @@ {% endif %} {% endif %} - {% if c.parent_submission %} + {% if c.parent_post %} {% set sub = c.post.sub %} {% if sub and v.mods(sub) and not c.author.mods(sub) %} @@ -656,7 +656,7 @@