remotes/1693045480750635534/spooky-22
Aevann1 2022-01-06 22:01:56 +02:00
parent ea8ed285de
commit 84d20891b5
3 changed files with 19 additions and 31 deletions

View File

@ -102,9 +102,10 @@ def NOTIFY_USERS(text, v):
if word in text.lower() and id not in notify_users and v.id != id: notify_users.add(id)
soup = BeautifulSoup(text, features="html.parser")
for mention in soup.find_all("a", href=re.compile("^/@(\w+)")):
username = mention["href"].split("@")[1]
user = g.db.query(User).filter_by(username=username).one_or_none()
if user and not v.any_block_exists(user) and user.id != v.id: notify_users.add(user.id)
for mention in soup.find_all("a", href=re.compile("^\/id\/([0-9]+)")):
id = mention["href"].split("/id/")[1]
if id != v.id:
user = g.db.query(User).filter_by(id=id).one_or_none()
if user and not v.any_block_exists(user): notify_users.add(user.id)
return notify_users

View File

@ -518,31 +518,7 @@
{% if render_replies %}
{% if level<10 %}
<div id="replies-of-{{c.id}}">
{% for reply in replies %}
{{single_comment(reply, level=level+1)}}
{% endfor %}
</div>
{% elif replies and "notifications" in request.path %}
<div id="replies-of-{{c.id}}" class="d-none d-md-block">
{% set standalone=False %}
{% for reply in replies %}
{{single_comment(reply, level=level+1)}}
{% endfor %}
</div>
<div id="morecomment-{{c.id}}" class="d-md-none mt-2 more-comments">
<a href="{{c.shortlink}}">More comments <i class="fas fa-long-arrow-right ml-1"></i></a>
</div>
{% elif replies %}
<div id="morecomments-{{c.id}}" class="mt-2 more-comments">
<button id="btn-{{c.id}}" class="d-none d-md-block btn btn-primary" onclick="morecomments('{{c.id}}')">More comments</button>
<a class="d-md-none" href="{{c.shortlink}}">More comments <i class="fas fa-long-arrow-right ml-1"></i></a>
</div>
{% endif %}
{% if request.path == '/notifications' and not replies and not c.parent_submission and c.author_id not in (NOTIFICATIONS_ID, AUTOJANNY_ID) %}
{% if request.path == '/notifications' and not replies and c.sentto and not c.parent_submission and c.author_id not in (NOTIFICATIONS_ID, AUTOJANNY_ID) %}
<a class="btn btn-primary" role="button" onclick="openReplyBox('reply-message-{{c.id}}')">Reply</a>
<pre></pre>
<div id="reply-message-{{c.id}}" class="d-none">
@ -562,6 +538,17 @@
<div id="message-reply-{{c.id}}" class="preview-edit mt-2"></div>
</div>
</div>
{% elif level<10 %}
<div id="replies-of-{{c.id}}">
{% for reply in replies %}
{{single_comment(reply, level=level+1)}}
{% endfor %}
</div>
{% elif replies %}
<div id="morecomments-{{c.id}}" class="mt-2 more-comments">
<button id="btn-{{c.id}}" class="d-none d-md-block btn btn-primary" onclick="morecomments('{{c.id}}')">More comments</button>
<a class="d-md-none" href="{{c.shortlink}}">More comments <i class="fas fa-long-arrow-right ml-1"></i></a>
</div>
{% endif %}
{% endif %}
</div>
@ -853,7 +840,7 @@
{% if v %}
<script src="/static/assets/js/marked.js?a=3"></script>
<script src="/static/assets/js/comments_v.js?a=9"></script>
<script src="/static/assets/js/comments_v.js?a=10"></script>
{% endif %}
<script src="/static/assets/js/clipboard.js?a=3"></script>

View File

@ -254,7 +254,7 @@
{% endif %}
{% if v %}
<a class="list-inline-item" role="button" data-bs-toggle="dropdown" aria-expanded="false" data-bs-auto-close="outside"><i class="fas fa-ellipsis-h fa-fw"></i></a>
<a class="list-inline-item" role="button" data-bs-toggle="dropdown" aria-expanded="false" ><i class="fas fa-ellipsis-h fa-fw"></i></a>
<ul class="dropdown-menu">
{% if v.admin_level > 0 %}