diff --git a/files/classes/mod_logs.py b/files/classes/mod_logs.py index 8e4cf6af6..e2310965e 100644 --- a/files/classes/mod_logs.py +++ b/files/classes/mod_logs.py @@ -95,7 +95,7 @@ class ModAction(Base): elif self.target_post: if self.target_post.club: return f'{cc.upper()} ONLY' return f'{self.target_post.title.replace("<","").replace(">","")}' - elif self.target_comment_id: return f'comment' + elif self.target_comment_id: return f'comment' @property @lazy diff --git a/files/routes/front.py b/files/routes/front.py index a4107d422..f655a41a4 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -167,6 +167,24 @@ def front_all(v): g.db.add(v) 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} else: return render_template("home.html", v=v, listing=posts, next_exists=next_exists, sort=sort, t=t, page=page) diff --git a/files/routes/settings.py b/files/routes/settings.py index 4ddec6664..537369e7b 100644 --- a/files/routes/settings.py +++ b/files/routes/settings.py @@ -155,6 +155,13 @@ def settings_profile_post(v): 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") == "": v.sig = None v.sig_html = None diff --git a/files/routes/users.py b/files/routes/users.py index aeef7b113..7c244a11d 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -454,12 +454,12 @@ def api_is_available(name, v): if len(name)<3 or len(name)>25: return {name:False} - name=name.replace('_','\_') + name2 = name.replace('_','\_') x= g.db.query(User).filter( or_( - User.username.ilike(name), - User.original_username.ilike(name) + User.username.ilike(name2), + User.original_username.ilike(name2) ) ).first() @@ -468,7 +468,6 @@ def api_is_available(name, v): else: return {name: True} - @app.get("/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) - 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}."} 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."} else: return render_template("userpage_blocked.html", u=u, v=v) diff --git a/files/templates/comments.html b/files/templates/comments.html index 37f98335b..a0f7787e0 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -207,7 +207,7 @@ {{single_comment(reply, level=level+1)}} {% endfor %} - {% elif "notifications" in request.path %} + {% elif replies and "notifications" in request.path %}
{% set standalone=False %} {% for reply in replies %} @@ -579,7 +579,7 @@ {{single_comment(reply, level=level+1)}} {% endfor %}
- {% elif "notifications" in request.path %} + {% elif replies and "notifications" in request.path %}
{% set standalone=False %} {% for reply in replies %} diff --git a/files/templates/emoji_modal.html b/files/templates/emoji_modal.html index b59cd0c90..410afa1b8 100644 --- a/files/templates/emoji_modal.html +++ b/files/templates/emoji_modal.html @@ -1,4 +1,4 @@ - +