master
Aevann1 2021-11-30 15:09:17 +02:00
parent d1de2aabb6
commit 97d668a7e7
8 changed files with 38 additions and 14 deletions

View File

@ -95,7 +95,7 @@ class ModAction(Base):
elif self.target_post: elif self.target_post:
if self.target_post.club: return f'<a href="{self.target_post.permalink}">{cc.upper()} ONLY</a>' if self.target_post.club: return f'<a href="{self.target_post.permalink}">{cc.upper()} ONLY</a>'
return f'<a href="{self.target_post.permalink}">{self.target_post.title.replace("<","").replace(">","")}</a>' return f'<a href="{self.target_post.permalink}">{self.target_post.title.replace("<","").replace(">","")}</a>'
elif self.target_comment_id: return f'<a href="/comment/{self.target_comment_id}">comment</a>' elif self.target_comment_id: return f'<a href="/comment/{self.target_comment_id}?context=9#context">comment</a>'
@property @property
@lazy @lazy

View File

@ -167,6 +167,24 @@ def front_all(v):
g.db.add(v) g.db.add(v)
g.db.commit() g.db.commit()
if v.marseyawarded and v.marseyawarded < time.time():
v.marseyawarded = None
send_notification(v.id, "Your marsey award has expired!")
g.db.add(v)
g.db.commit()
if v.longpost and v.longpost < time.time():
v.longpost = None
send_notification(v.id, "Your pizzashill award has expired!")
g.db.add(v)
g.db.commit()
if v.bird and v.bird < time.time():
v.bird = None
send_notification(v.id, "Your bird site award has expired!")
g.db.add(v)
g.db.commit()
if request.headers.get("Authorization"): return {"data": [x.json for x in posts], "next_exists": next_exists} if request.headers.get("Authorization"): return {"data": [x.json for x in posts], "next_exists": next_exists}
else: return render_template("home.html", v=v, listing=posts, next_exists=next_exists, sort=sort, t=t, page=page) else: return render_template("home.html", v=v, listing=posts, next_exists=next_exists, sort=sort, t=t, page=page)

View File

@ -155,6 +155,13 @@ def settings_profile_post(v):
msg="Your bio has been updated.") msg="Your bio has been updated.")
elif request.values.get("bio") == "":
v.bio = None
v.bio_html = None
g.db.add(v)
g.db.commit()
return render_template("settings_profile.html", v=v, msg="Your bio has been updated.")
elif request.values.get("sig") == "": elif request.values.get("sig") == "":
v.sig = None v.sig = None
v.sig_html = None v.sig_html = None

View File

@ -454,12 +454,12 @@ def api_is_available(name, v):
if len(name)<3 or len(name)>25: if len(name)<3 or len(name)>25:
return {name:False} return {name:False}
name=name.replace('_','\_') name2 = name.replace('_','\_')
x= g.db.query(User).filter( x= g.db.query(User).filter(
or_( or_(
User.username.ilike(name), User.username.ilike(name2),
User.original_username.ilike(name) User.original_username.ilike(name2)
) )
).first() ).first()
@ -468,7 +468,6 @@ def api_is_available(name, v):
else: else:
return {name: True} return {name: True}
@app.get("/id/<id>") @app.get("/id/<id>")
def user_id(id): def user_id(id):
@ -556,12 +555,12 @@ def u_username(username, v=None):
else: return render_template("userpage_private.html", time=int(time.time()), u=u, v=v) else: return render_template("userpage_private.html", time=int(time.time()), u=u, v=v)
if hasattr(u, 'is_blocking') and u.is_blocking and (not v or v.admin_level < 2): if v and hasattr(u, 'is_blocking') and u.is_blocking:
if request.headers.get("Authorization"): return {"error": f"You are blocking @{u.username}."} if request.headers.get("Authorization"): return {"error": f"You are blocking @{u.username}."}
else: return render_template("userpage_blocking.html", u=u, v=v) else: return render_template("userpage_blocking.html", u=u, v=v)
if hasattr(u, 'is_blocked') and u.is_blocked and (not v or v.admin_level < 2): if v and v.admin_level < 2 and hasattr(u, 'is_blocked') and u.is_blocked:
if request.headers.get("Authorization"): return {"error": "This person is blocking you."} if request.headers.get("Authorization"): return {"error": "This person is blocking you."}
else: return render_template("userpage_blocked.html", u=u, v=v) else: return render_template("userpage_blocked.html", u=u, v=v)

View File

@ -207,7 +207,7 @@
{{single_comment(reply, level=level+1)}} {{single_comment(reply, level=level+1)}}
{% endfor %} {% endfor %}
</div> </div>
{% elif "notifications" in request.path %} {% elif replies and "notifications" in request.path %}
<div id="replies-of-{{c.id}}" class="d-none d-md-block"> <div id="replies-of-{{c.id}}" class="d-none d-md-block">
{% set standalone=False %} {% set standalone=False %}
{% for reply in replies %} {% for reply in replies %}
@ -579,7 +579,7 @@
{{single_comment(reply, level=level+1)}} {{single_comment(reply, level=level+1)}}
{% endfor %} {% endfor %}
</div> </div>
{% elif "notifications" in request.path %} {% elif replies and "notifications" in request.path %}
<div id="replies-of-{{c.id}}" class="d-none d-md-block"> <div id="replies-of-{{c.id}}" class="d-none d-md-block">
{% set standalone=False %} {% set standalone=False %}
{% for reply in replies %} {% for reply in replies %}

View File

@ -1,4 +1,4 @@
<script src="/assets/js/emoji_modal.js?v=120"></script> <script src="/assets/js/emoji_modal.js?v=121"></script>
<style> <style>
a.emojitab { a.emojitab {

View File

@ -4,7 +4,7 @@
<head> <head>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/js/bootstrap.bundle.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/js/bootstrap.bundle.min.js"></script>
<script src="/assets/js/signup.js?v=53"></script> <script src="/assets/js/signup.js?v=63"></script>
{% if hcaptcha %} {% if hcaptcha %}
<script src="https://hcaptcha.com/1/api.js"></script> <script src="https://hcaptcha.com/1/api.js"></script>
@ -89,7 +89,7 @@
<label for="username-register" class="mt-3">Username</label> <label for="username-register" class="mt-3">Username</label>
<input class="form-control" id="username-register" <input class="form-control" id="username-register"
aria-describedby="usernameHelpRegister" type="text" name="username" pattern="[a-zA-Z0-9_\-]{3,25}" required=""> aria-describedby="usernameHelpRegister" type="text" name="username" pattern="[a-zA-Z0-9_\-]{3,25}" min="3" max="25" required="">
<small id="usernameHelpRegister"></small> <small id="usernameHelpRegister"></small>
<label for="email-register" class="mt-3">Email Address</label> <label for="email-register" class="mt-3">Email Address</label>

View File

@ -147,7 +147,7 @@
</span> </span>
{% endif %} {% endif %}
{% if v and v.has_follower(u) %} {% if v and v.has_follower(u) %}
<span class="followsyou text-primary badge badge-secondary text-small align-middle ml-2">Follows you</span> <span class="followsyou badge badge-secondary text-small align-middle ml-2">Follows you</span>
{% endif %} {% endif %}
<div class="profile-actions align-middle d-none ml-2"> <div class="profile-actions align-middle d-none ml-2">
{% if v and v.id != u.id %} {% if v and v.id != u.id %}
@ -446,7 +446,7 @@
</span> </span>
{% endif %} {% endif %}
{% if v and v.has_follower(u) and not v.is_nofollow %} {% if v and v.has_follower(u) and not v.is_nofollow %}
<span class="followsyou text-primary badge badge-secondary text-small align-middle mx-1">Follows you</span> <span class="followsyou badge badge-secondary text-small align-middle mx-1">Follows you</span>
{% endif %} {% endif %}
{% if u.customtitle %}<p style="color: #{{u.titlecolor}}">{% if u.quadrant %}<img loading="lazy" height="20" src="/assets/images/quadrants/{{u.quadrant}}.webp?v=1">{% endif %}{{u.customtitle | safe}}</p> {% if u.customtitle %}<p style="color: #{{u.titlecolor}}">{% if u.quadrant %}<img loading="lazy" height="20" src="/assets/images/quadrants/{{u.quadrant}}.webp?v=1">{% endif %}{{u.customtitle | safe}}</p>
{% else %} {% else %}