From d90a161c45f8a1b45c25d9f0db88876a6dbec78b Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 7 Nov 2021 16:09:20 +0200 Subject: [PATCH] dfsfds --- files/routes/front.py | 11 +++++++++++ files/routes/votes.py | 22 ---------------------- 2 files changed, 11 insertions(+), 22 deletions(-) diff --git a/files/routes/front.py b/files/routes/front.py index befd93e53..04b19f424 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -138,6 +138,17 @@ def front_all(v): if v and v.hidevotedon: posts = [x for x in posts if not hasattr(x, 'voted') or not x.voted] + if v.agendaposter_expires_utc and v.agendaposter_expires_utc < time.time(): + v.agendaposter_expires_utc = 0 + v.agendaposter = False + g.db.add(v) + send_notification(v.id, "Your agendaposter theme has expired!") + + if v.flairchanged and v.flairchanged < time.time(): + v.flairchanged = None + g.db.add(v) + send_notification(v.id, "Your flair lock has expired. You can now change your flair!") + 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/votes.py b/files/routes/votes.py index 47285f902..19e35363a 100644 --- a/files/routes/votes.py +++ b/files/routes/votes.py @@ -103,17 +103,6 @@ def api_vote_post(post_id, new, v): g.db.add(post) cache.delete_memoized(frontlist) - if v.agendaposter_expires_utc and v.agendaposter_expires_utc < time.time(): - v.agendaposter_expires_utc = 0 - v.agendaposter = False - g.db.add(v) - send_notification(v.id, "Your agendaposter theme has expired!") - - if v.flairchanged and v.flairchanged < time.time(): - v.flairchanged = None - g.db.add(v) - send_notification(v.id, "Your flair lock has expired. You can now change your flair!") - try: g.db.flush() post.upvotes = g.db.query(Vote.id).filter_by(submission_id=post.id, vote_type=1).count() @@ -176,17 +165,6 @@ def api_vote_comment(comment_id, new, v): comment.is_pinned = None g.db.add(comment) - if v.agendaposter_expires_utc and v.agendaposter_expires_utc < time.time(): - v.agendaposter_expires_utc = 0 - v.agendaposter = False - g.db.add(v) - send_notification(v.id, "Your agendaposter theme has expired!") - - if v.flairchanged and v.flairchanged < time.time(): - v.flairchanged = None - g.db.add(v) - send_notification(v.id, "Your flair lock has expired. You can now change your flair!") - try: g.db.flush() comment.upvotes = g.db.query(CommentVote.id).filter_by(comment_id=comment.id, vote_type=1).count()