master
Aevann1 2021-11-05 16:27:51 +02:00
parent fb7d771daa
commit 288c703847
3 changed files with 11 additions and 9 deletions

View File

@ -203,14 +203,14 @@ def settings_profile_post(v):
if bans:
ban = bans[0]
reason = f"Remove the {ban.domain} link from your top 8 friends list and try again."
reason = f"Remove the {ban.domain} link from your top friends list and try again."
if ban.reason: reason += f" {ban.reason}"
return {"error": reason}, 401
if len(friends_html) > 2000:
return render_template("settings_profile.html",
v=v,
error="Your top 8 friends list is too long")
error="Your top friends list is too long")
notify_users = set()
@ -222,8 +222,10 @@ def settings_profile_post(v):
if request.host == 'rdrama.net' and 'aevann' in friends_html.lower() and 1 not in notify_users: notify_users.add(1)
for x in notify_users: send_notification(x, f"@{v.username} has added you to their top 8 friends!")
for x in notify_users:
message = f"@{v.username} has added you to their top friends!"
existing = g.db.query(Comment).options(lazyload('*')).filter(Comment.author_id == NOTIFICATIONS_ACCOUNT, Comment.body == message, Comment.notifiedto == x).first()
if not existing: send_notification(x, message)
v.friends = friends[:500]
v.friends_html=friends_html
@ -231,7 +233,7 @@ def settings_profile_post(v):
g.db.commit()
return render_template("settings_profile.html",
v=v,
msg="Your top 8 friends have been updated.")
msg="Your top friends have been updated.")

View File

@ -590,13 +590,13 @@
<div class="body d-lg-flex border-bottom">
<label class="text-black w-lg-25">Top 8 friends</label>
<label class="text-black w-lg-25">Top friends</label>
<div class="w-lg-100">
<form id="profile-friends" action="/settings/profile" method="post" enctype="multipart/form-data">
<input type="hidden" name="formkey" value="{{v.formkey}}">
<div class="input-group mb-2">
<textarea id="friends-text" class="form-control rounded" aria-label="With textarea" placeholder="Enter your top 8 friends on the site..." rows="3" name="friends" form="profile-friends" maxlength="1500">{% if v.friends %}{{v.friends}}{% endif %}</textarea>
<textarea id="friends-text" class="form-control rounded" aria-label="With textarea" placeholder="Enter your top friends on the site..." rows="3" name="friends" form="profile-friends" maxlength="1500">{% if v.friends %}{{v.friends}}{% endif %}</textarea>
</div>
<pre></pre>
<div class="d-flex">

View File

@ -177,7 +177,7 @@
{% endif %}
{% if u.friends_html %}
<p class="text-muted font-weight-bold">Top 8 friends:</p>
<p class="text-muted font-weight-bold">Top friends:</p>
{{u.friends_html | safe}}
{% endif %}
@ -448,7 +448,7 @@
{% endif %}
{% if u.friends_html %}
<p class="text-muted font-weight-bold mt-3">Top 8 friends:</p>
<p class="text-muted font-weight-bold mt-3">Top friends:</p>
{{u.friends_html | safe}}
{% endif %}