diff --git a/files/classes/comment.py b/files/classes/comment.py index ff6333ecf..8cd8b0b4b 100644 --- a/files/classes/comment.py +++ b/files/classes/comment.py @@ -314,7 +314,7 @@ class Comment(Base): if path == '/admin/removed/comments': return False - if '?context' in path or f'/{self.id}' in path: return False + if comment_link_regex.search(path): return False if self.over_18 and not (v and v.over_18) and not (self.post and self.post.over_18): return True diff --git a/files/helpers/regex.py b/files/helpers/regex.py index 7f764e68c..d8212340b 100644 --- a/files/helpers/regex.py +++ b/files/helpers/regex.py @@ -194,3 +194,5 @@ reason_regex_comment = re.compile('(/comment/[0-9]+)', flags=re.A) discord_username_regex = re.compile("(\s|^|>).{2,32}#[0-9]{4}(?=[^0-9]|$)", flags=re.A) numbered_list_regex = re.compile('((\s|^)[0-9]+)\. ', flags=re.A) + +comment_link_regex = re.compile("/[0-9]+$", flags=re.A)