fix images in modmail

pull/104/head
Aevann 2023-01-28 10:47:52 +02:00
parent a2d8bcf6ab
commit cd573133a9
3 changed files with 15 additions and 7 deletions

View File

@ -267,6 +267,8 @@ def process_dm_images(v, user):
if body:
with open(f"{LOG_DIRECTORY}/dm_images.log", "a+", encoding="utf-8") as f:
f.write(f'{body.strip()}, {v.username}, {v.id}, {user.username}, {user.id}\n')
if user:
f.write(f'{body.strip()}, {v.username}, {v.id}, {user.username}, {user.id}\n')
else:
f.write(f'{body.strip()}, {v.username}, {v.id}, Modmail, Modmail\n')
return body

View File

@ -557,6 +557,8 @@ def messagereply(v:User):
if parent.sentto == MODMAIL_ID: user_id = None
elif v.id == user_id: user_id = parent.sentto
user = None
if user_id:
user = get_account(user_id, v=v, include_blocks=True)
if hasattr(user, 'is_blocking') and user.is_blocking:
@ -565,7 +567,7 @@ def messagereply(v:User):
and hasattr(user, 'is_blocked') and user.is_blocked):
abort(403, f"You're blocked by @{user.username}")
body += process_dm_images(v, user)
body += process_dm_images(v, user)
body = body.strip()

View File

@ -31,10 +31,14 @@
</td>
<td>
{% if item[1] != "Unknown" %}
<a href="/id/{{item[4]}}">
<img loading="lazy" src="/pp/{{item[4]}}">
@{{item[3]}}
</a>
{% if item[3] == "Modmail" %}
Modmail
{% else %}
<a href="/id/{{item[4]}}">
<img loading="lazy" src="/pp/{{item[4]}}">
@{{item[3]}}
</a>
{% endif %}
{% endif %}
</td>
</tr>