master
Aevann1 2022-02-26 21:01:32 +02:00
parent e0dfe332c2
commit ad761ac0ae
3 changed files with 5 additions and 5 deletions

View File

@ -668,5 +668,5 @@ db = db_session()
marseys_const = [x[0] for x in db.query(Marsey.name).all()] + ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','0','1','2','3','4','5','6','7','8','9','exclamationpoint','period','questionmark']
db.close()
if SITE == 'PCM': valid_username_regex = re.compile("^[a-zA-Z0-9_\-А-я]{3,25}$", flags=re.A)
else: valid_username_regex = re.compile("^[a-zA-Z0-9_\-]{3,25}$", flags=re.A)
if SITE == 'PCM': valid_username_regex = re.compile("^[a-zA-Z0-9_\-А-я]{3,25}$")
else: valid_username_regex = re.compile("^[a-zA-Z0-9_\-]{3,25}$")

View File

@ -85,7 +85,7 @@ def get_account(id, v=None):
UserBlock.target_id == v.id
)
)
).one_or_none()
).first()
user.is_blocking = block and block.user_id == v.id
user.is_blocked = block and block.target_id == v.id
@ -200,7 +200,7 @@ def get_comment(i, v=None, graceful=False):
UserBlock.target_id == v.id
)
)
).one_or_none()
).first()
vts = g.db.query(CommentVote).filter_by(user_id=v.id, comment_id=comment.id)
vt = g.db.query(CommentVote).filter_by(user_id=v.id, comment_id=comment.id).one_or_none()

View File

@ -125,7 +125,7 @@ def sanitize(sanitized, noimages=False, alert=False, comment=False, edit=False):
sanitized = re.sub('(^|\s|\n|<p>)\/?(s\/(\w|-){3,25})', r'\1<a href="/\2" rel="nofollow noopener noreferrer">/\2</a>', sanitized, flags=re.A)
for i in re.finditer(valid_username_regex, sanitized, flags=re.A):
for i in re.finditer(valid_username_regex, sanitized):
u = get_user(i.group(2), graceful=True)
if u and (not g.v.any_block_exists(u) or g.v.admin_level > 1):