fds
This commit is contained in:
parent
9ef7da1f59
commit
20cf78883d
5 changed files with 27 additions and 20 deletions
|
@ -27,7 +27,9 @@ def send_repeatable_notification(uid, text, autojanny=False):
|
|||
text_html = sanitize(Renderer2().render(mistletoe.Document(text)))
|
||||
|
||||
for i in re.finditer("<p>@((\w|-){1,25})", text_html):
|
||||
text_html = text_html.replace(f'@{i.group(1)}', f'<a href="/@{i.group(1)}"><img loading="lazy" src="/@{i.group(1)}/pic" class="pp20">@{i.group(1)}</a>')
|
||||
u = get_user(i.group(1), graceful=True)
|
||||
if u:
|
||||
text_html = text_html.replace(f'<p>@{u.username}', f'<p><a href="{u.url2}"><img loading="lazy" src="/uid/{u.id}/pic" class="pp20">@{u.username}</a>')
|
||||
|
||||
existing_comment = g.db.query(Comment.id).filter_by(author_id=author_id, parent_submission=None, distinguish_level=6, body_html=text_html, created_utc=0).first()
|
||||
|
||||
|
@ -55,7 +57,9 @@ def notif_comment(text, autojanny=False):
|
|||
text_html = sanitize(Renderer2().render(mistletoe.Document(text)))
|
||||
|
||||
for i in re.finditer("<p>@((\w|-){1,25})", text_html):
|
||||
text_html = text_html.replace(f'<p>@{i.group(1)}', f'<p><a href="/@{i.group(1)}"><img loading="lazy" src="/@{i.group(1)}/pic" class="pp20">@{i.group(1)}</a>')
|
||||
u = get_user(i.group(1), graceful=True)
|
||||
if u:
|
||||
text_html = text_html.replace(f'<p>@{u.username}', f'<p><a href="{user.url2}"><img loading="lazy" src="/uid/{u.id}/pic" class="pp20">@{u.username}</a>')
|
||||
|
||||
existing = g.db.query(Comment.id).filter_by(author_id=author_id, parent_submission=None, distinguish_level=6, body_html=text_html, created_utc=0).first()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue