make sure all comment links have #context
parent
055d457fe6
commit
95938ee3ec
|
@ -217,7 +217,7 @@ class Comment(Base):
|
|||
'is_banned': bool(self.is_banned),
|
||||
'deleted_utc': self.deleted_utc,
|
||||
'is_nsfw': self.over_18,
|
||||
'permalink': f'/comment/{self.id}',
|
||||
'permalink': f'/comment/{self.id}#context',
|
||||
'stickied': self.stickied,
|
||||
'distinguish_level': self.distinguish_level,
|
||||
'post_id': self.post.id if self.post else 0,
|
||||
|
|
|
@ -190,7 +190,8 @@ def command_regex_matcher(match, upper=False):
|
|||
result = f'<b style="color:rgb{color}">Your roll: {result}</b>'
|
||||
return match.group(1) + result
|
||||
|
||||
reason_regex = re.compile('(/(post|comment)/[0-9]+)', flags=re.A)
|
||||
reason_regex_post = re.compile('(/post/[0-9]+)', flags=re.A)
|
||||
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)
|
||||
|
||||
|
|
|
@ -902,7 +902,8 @@ def ban_user(id, v):
|
|||
|
||||
reason = filter_emojis_only(reason)
|
||||
|
||||
reason = reason_regex.sub(r'<a href="\1">\1</a>', reason)
|
||||
reason = reason_regex_post.sub(r'<a href="\1">\1</a>', reason)
|
||||
reason = reason_regex_comment.sub(r'<a href="\1#context">\1</a>', reason)
|
||||
|
||||
user.ban(admin=v, reason=reason, days=days)
|
||||
|
||||
|
@ -984,7 +985,8 @@ def agendaposter(id, v):
|
|||
|
||||
reason = filter_emojis_only(reason)
|
||||
|
||||
reason = reason_regex.sub(r'<a href="\1">\1</a>', reason)
|
||||
reason = reason_regex_post.sub(r'<a href="\1">\1</a>', reason)
|
||||
reason = reason_regex_comment.sub(r'<a href="\1#context">\1</a>', reason)
|
||||
|
||||
duration = "permanently"
|
||||
if days:
|
||||
|
|
|
@ -243,8 +243,12 @@ def award_thing(v, thing_type, id):
|
|||
author.ban_reason = None
|
||||
send_repeatable_notification(author.id, "You have been unbanned!")
|
||||
elif kind == "grass":
|
||||
link3 = f"/{thing_type}/{thing.id}"
|
||||
if thing_type == 'comment':
|
||||
link3 += '#context'
|
||||
|
||||
author.is_banned = AUTOJANNY_ID
|
||||
author.ban_reason = f"grass award used by @{v.username} on /{thing_type}/{thing.id}"
|
||||
author.ban_reason = f"grass award used by @{v.username} on {link3}"
|
||||
author.unban_utc = int(time.time()) + 30 * 86400
|
||||
send_repeatable_notification(author.id, f"Your account has been banned permanently for {link}. You must [provide the admins](/contact) a timestamped picture of you touching grass/snow/sand/ass to get unbanned!")
|
||||
elif kind == "pin":
|
||||
|
|
|
@ -230,7 +230,7 @@ def comment(v:User):
|
|||
Comment.wall_user_id == post_target.id if not posting_to_submission else None,
|
||||
Comment.body_html == body_html
|
||||
).first()
|
||||
if existing: abort(409, f"You already made that comment: /comment/{existing.id}")
|
||||
if existing: abort(409, f"You already made that comment: /comment/{existing.id}#context")
|
||||
|
||||
execute_antispam_comment_check(body, v)
|
||||
execute_antispam_duplicate_comment_check(v, body_html)
|
||||
|
|
Loading…
Reference in New Issue