diff --git a/files/helpers/const.py b/files/helpers/const.py index 1a6424755..2829aedbb 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -367,14 +367,6 @@ AWARDS = { "color": "text-blue", "price": 300 }, - "ghost": { - "kind": "ghost", - "title": "Ghost", - "description": "Hides the usernames of everyone in the thread", - "icon": "fas fa-ghost", - "color": "text-white", - "price": 500 - }, "rehab": { "kind": "rehab", "title": "Rehab", @@ -439,6 +431,14 @@ AWARDS = { "color": "text-purple", "price": 2500 }, + "ghost": { + "kind": "ghost", + "title": "Ghost", + "description": "Hides the usernames of everyone in the thread", + "icon": "fas fa-ghost", + "color": "text-white", + "price": 3000 + }, "marsey": { "kind": "marsey", "title": "Marsey", diff --git a/files/routes/posts.py b/files/routes/posts.py index af7e4d848..d24efdcc8 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -40,32 +40,6 @@ discounts = { titleheaders = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.72 Safari/537.36"} -def ghost_price(v): - if v.patron == 1: discount = 0.90 - elif v.patron == 2: discount = 0.85 - elif v.patron == 3: discount = 0.80 - elif v.patron == 4: discount = 0.75 - elif v.patron == 5: discount = 0.70 - elif v.patron == 6: discount = 0.65 - else: discount = 1 - for badge in [69,70,71,72,73]: - if v.has_badge(badge): discount -= discounts[badge] - - return int(500*discount) - - -def submit_ghost(v,db): - ghost = db.query(AwardRelationship.id).filter( - AwardRelationship.kind == 'ghost', - AwardRelationship.user_id == v.id, - AwardRelationship.submission_id == None, - AwardRelationship.comment_id == None - ).first() - - if ghost: ghost = 42069 - else: ghost = ghost_price(v) - return ghost - @app.post("/toggle_club/") @auth_required @@ -136,7 +110,7 @@ def submit_get(v, sub=None): SUBS = [x[0] for x in g.db.query(Sub.name).order_by(Sub.name).all()] - return render_template("submit.html", SUBS=SUBS, v=v, sub=sub, ghost=submit_ghost(v,g.db)) + return render_template("submit.html", SUBS=SUBS, v=v, sub=sub) @app.get("/post/") @app.get("/post//") @@ -824,7 +798,7 @@ def submit_post(v, sub=None): if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error": error}, 403 SUBS = [x[0] for x in g.db.query(Sub.name).order_by(Sub.name).all()] - return render_template("submit.html", SUBS=SUBS, v=v, error=error, title=title, url=url, body=body, ghost=submit_ghost(v,g.db)), 400 + return render_template("submit.html", SUBS=SUBS, v=v, error=error, title=title, url=url, body=body), 400 sub = request.values.get("sub") @@ -1083,32 +1057,12 @@ def submit_post(v, sub=None): title=title[:500], title_html=title_html, sub=sub, - ghost=False + ghost=bool(request.values.get("ghost","")) ) g.db.add(post) g.db.flush() - if request.values.get('ghost'): - - ghost_award = g.db.query(AwardRelationship).filter( - AwardRelationship.kind == 'ghost', - AwardRelationship.user_id == v.id, - AwardRelationship.submission_id == None, - AwardRelationship.comment_id == None - ).first() - - if ghost_award: - ghost_award.submission_id = post.id - post.ghost = True - else: - price = ghost_price(v) - if v.coins >= price: - v.coins -= price - post.ghost = True - elif v.procoins >= price: - v.procoins -= price - post.ghost = True if v and v.admin_level > 2: for option in bet_options: diff --git a/files/templates/submit.html b/files/templates/submit.html index 557c4e233..50e42efcf 100644 --- a/files/templates/submit.html +++ b/files/templates/submit.html @@ -189,12 +189,8 @@ {% endif %}
- - {% if ghost == 42069 %} - - {% else %} - - {% endif %} + +