diff --git a/files/routes/admin.py b/files/routes/admin.py index 21da8b4fd..c783550ec 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -60,7 +60,8 @@ def remove_admin(v, username): def distribute(v, comment): try: comment = int(comment) except: abort(400) - post = g.db.query(Comment).filter_by(id=comment).one_or_none().post + post = g.db.query(Comment.parent_submission).filter_by(id=comment).one_or_none()[0] + post = g.db.query(Submission).filter_by(id=post).one_or_none() pool = 0 for option in post.bet_options: pool += option.upvotes @@ -86,6 +87,9 @@ def distribute(v, comment): votes = g.db.query(CommentVote).filter(CommentVote.comment_id.in_(cids)).all() for vote in votes: add_notif(cid, vote.user.id) + post.body += '\n\nclosed' + g.db.add(post) + g.db.commit() return {"message": f"Each winner has received {coinsperperson} coins!"} diff --git a/files/routes/users.py b/files/routes/users.py index fde075644..b89d2be25 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -873,9 +873,13 @@ def remove_follow(username, v): @app.get("/uid//pic") @app.get("/uid//pic/profile") +@app.get("/logged_out/uid//pic") @limiter.exempt @auth_desired def user_profile_uid(v, id): + if not v and not request.path.startswith('/logged_out'): return redirect(f"/logged_out{request.full_path}") + if v and request.path.startswith('/logged_out'): v = None + try: id = int(id) except: try: id = int(id, 36)