From 702d528d4a97e011a2d744b6c87d6aa7b2344811 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 27 Dec 2021 03:08:06 +0200 Subject: [PATCH] fsd --- files/classes/user.py | 3 --- files/routes/admin.py | 19 ++----------------- files/routes/awards.py | 12 ------------ files/routes/comments.py | 7 ++++--- files/routes/posts.py | 2 +- files/routes/settings.py | 6 +----- files/routes/votes.py | 14 ++++++-------- files/templates/default.html | 2 +- files/templates/emoji_modal.html | 2 +- files/templates/userpage.html | 6 ++---- schema.sql | 2 -- 11 files changed, 18 insertions(+), 57 deletions(-) diff --git a/files/classes/user.py b/files/classes/user.py index 2d70c0010..0926f54d3 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -87,8 +87,6 @@ class User(Base): oldreddit = Column(Boolean, default=True) teddit = Column(Boolean) nitter = Column(Boolean) - grinch = Column(Boolean) - grincheffect = Column(Boolean) mute = Column(Boolean) unmutable = Column(Boolean) eye = Column(Boolean) @@ -431,7 +429,6 @@ class User(Base): @property @lazy def profile_url(self): - if self.grincheffect: return f"https://{site}/static/assets/images/grinch.webp?a=200" if self.agendaposter: return f"https://{site}/static/assets/images/defaultpictures/agendaposter/{random.randint(1, 50)}.webp?a=200" if self.profileurl: return self.profileurl if "rama" in site: return f"https://{site}/static/assets/images/defaultpictures/{random.randint(1, 150)}.webp?a=200" diff --git a/files/routes/admin.py b/files/routes/admin.py index fab1058b7..36e53fa68 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -149,21 +149,6 @@ def club_ban(v, username): g.db.commit() return {"message": f"@{username} has been kicked from the {cc}. Deserved."} - -@app.post("/@/make_admin") -@limiter.limit("1/second") -@admin_level_required(2) -@validate_formkey -def make_admin(v, username): - if 'pcm' in request.host or (SITE_NAME == 'Drama' and v.admin_level > 2) or ('rama' not in request.host and 'pcm' not in request.host): - user = get_user(username) - if not user: abort(404) - user.admin_level = 2 - g.db.add(user) - g.db.commit() - return {"message": "User has been made admin!"} - - @app.post("/@/remove_admin") @limiter.limit("1/second") @admin_level_required(2) @@ -962,7 +947,7 @@ def ban_post(post_id, v): cache.delete_memoized(frontlist) - v.coins += 2 + v.coins += 1 g.db.add(v) g.db.commit() @@ -996,7 +981,7 @@ def unban_post(post_id, v): cache.delete_memoized(frontlist) - v.coins -= 2 + v.coins -= 1 g.db.add(v) g.db.commit() diff --git a/files/routes/awards.py b/files/routes/awards.py index adad64bbb..5197fa9bf 100644 --- a/files/routes/awards.py +++ b/files/routes/awards.py @@ -313,12 +313,6 @@ def award_post(pid, v): if not author.has_badge(90): new_badge = Badge(badge_id=90, user_id=author.id) g.db.add(new_badge) - elif kind == "grinch": - author.grinch = True - send_repeatable_notification(CARP_ID, f"@{v.username} used {kind} award!") - if not author.has_badge(91): - new_badge = Badge(badge_id=91, user_id=author.id) - g.db.add(new_badge) if post.author.received_award_count: post.author.received_award_count += 1 else: post.author.received_award_count = 1 @@ -486,12 +480,6 @@ def award_comment(cid, v): if not author.has_badge(90): new_badge = Badge(badge_id=90, user_id=author.id) g.db.add(new_badge) - elif kind == "grinch": - author.grinch = True - send_repeatable_notification(CARP_ID, f"@{v.username} used {kind} award!") - if not author.has_badge(91): - new_badge = Badge(badge_id=91, user_id=author.id) - g.db.add(new_badge) if c.author.received_award_count: c.author.received_award_count += 1 else: c.author.received_award_count = 1 diff --git a/files/routes/comments.py b/files/routes/comments.py index 054df4285..9134f081b 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -412,7 +412,7 @@ def api_comment(v): if v.id == PIZZA_SHILL_ID: cratvote = CommentVote(user_id=TAX_RECEIVER_ID, comment_id=c.id, vote_type=1) g.db.add(cratvote) - v.coins += 2 + v.coins += 1 v.truecoins += 1 g.db.add(v) c.upvotes += 1 @@ -438,7 +438,7 @@ def api_comment(v): longpostbot = g.db.query(User).filter_by(id = LONGPOSTBOT_ID).first() longpostbot.comment_count += 1 - longpostbot.coins += 2 + longpostbot.coins += 1 g.db.add(longpostbot) g.db.flush() @@ -493,7 +493,8 @@ def api_comment(v): ) g.db.add(c3) - + g.db.flush() + body = "zozzle" body_md = CustomRenderer().render(mistletoe.Document(body)) body_html2 = sanitize(body_md) diff --git a/files/routes/posts.py b/files/routes/posts.py index 230a2b3fa..df63d4afc 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -1183,7 +1183,7 @@ def submit_post(v): snappy = g.db.query(User).filter_by(id = SNAPPY_ID).first() snappy.comment_count += 1 - snappy.coins += 2 + snappy.coins += 1 g.db.add(snappy) if not v.is_blocking(snappy): diff --git a/files/routes/settings.py b/files/routes/settings.py index 66e81a9c2..49616b555 100644 --- a/files/routes/settings.py +++ b/files/routes/settings.py @@ -53,11 +53,7 @@ def settings_profile_post(v): updated = False - if request.values.get("grincheffect", v.grincheffect) != v.grincheffect: - updated = True - v.grincheffect = request.values.get("grincheffect", None) == 'true' - - elif request.values.get("background", v.background) != v.background: + if request.values.get("background", v.background) != v.background: updated = True v.background = request.values.get("background", None) diff --git a/files/routes/votes.py b/files/routes/votes.py index adab15691..e18ff923f 100644 --- a/files/routes/votes.py +++ b/files/routes/votes.py @@ -87,14 +87,13 @@ def api_vote_post(post_id, new, v): if existing: if existing.vote_type == 0 and new != 0: - post.author.coins += 2 + post.author.coins += 1 post.author.truecoins += 1 g.db.add(post.author) existing.vote_type = new g.db.add(existing) elif existing.vote_type != 0 and new == 0: - if post.created_utc > 1639302300: post.author.coins -= 2 - else: post.author.coins -= 1 + post.author.coins -= 1 post.author.truecoins -= 1 g.db.add(post.author) g.db.delete(existing) @@ -102,7 +101,7 @@ def api_vote_post(post_id, new, v): existing.vote_type = new g.db.add(existing) elif new != 0: - post.author.coins += 2 + post.author.coins += 1 post.author.truecoins += 1 g.db.add(post.author) real = (bool(v.profileurl) or bool(v.customtitle) or v.namecolor != defaultcolor) and not v.agendaposter and not v.shadowbanned @@ -153,14 +152,13 @@ def api_vote_comment(comment_id, new, v): if existing: if existing.vote_type == 0 and new != 0: - comment.author.coins += 2 + comment.author.coins += 1 comment.author.truecoins += 1 g.db.add(comment.author) existing.vote_type = new g.db.add(existing) elif existing.vote_type != 0 and new == 0: - if comment.created_utc > 1639302300: comment.author.coins -= 2 - else: comment.author.coins -= 1 + comment.author.coins -= 1 comment.author.truecoins -= 1 g.db.add(comment.author) g.db.delete(existing) @@ -168,7 +166,7 @@ def api_vote_comment(comment_id, new, v): existing.vote_type = new g.db.add(existing) elif new != 0: - comment.author.coins += 2 + comment.author.coins += 1 comment.author.truecoins += 1 g.db.add(comment.author) real = (bool(v.profileurl) or bool(v.customtitle) or v.namecolor != defaultcolor) and not v.agendaposter and not v.shadowbanned diff --git a/files/templates/default.html b/files/templates/default.html index d619092eb..7306406b5 100644 --- a/files/templates/default.html +++ b/files/templates/default.html @@ -207,7 +207,7 @@ - + {% endif %} {% endblock %} diff --git a/files/templates/emoji_modal.html b/files/templates/emoji_modal.html index a901e6285..786af1859 100644 --- a/files/templates/emoji_modal.html +++ b/files/templates/emoji_modal.html @@ -81,7 +81,7 @@ - +