master
Aevann1 2021-12-27 03:08:06 +02:00
parent 5b4aef2d41
commit 702d528d4a
11 changed files with 18 additions and 57 deletions

View File

@ -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"

View File

@ -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("/@<username>/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("/@<username>/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()

View File

@ -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

View File

@ -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)

View File

@ -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):

View File

@ -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)

View File

@ -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

View File

@ -207,7 +207,7 @@
</style>
<a rel="nofollow noopener noreferrer" href="{% if 'rama' in request.host %}https://secure.transequality.org/site/Donation2?df_id=1480{% else %}/{% endif %}">
<img class="banner" alt="banner" src="/static/assets/images/{{'SITE_NAME' | app_config}}/{% if v %}banner.webp{% else %}cached.webp{% endif %}?a=3" width="100%">
<img class="banner" alt="banner" src="/static/assets/images/{{'SITE_NAME' | app_config}}/{% if v %}banner.webp{% else %}cached.webp{% endif %}?a=4" width="100%">
</a>
{% endif %}
{% endblock %}

View File

@ -81,7 +81,7 @@
</div>
</div>
<script src="/static/assets/js/emoji_modal.js?a=4"></script>
<script src="/static/assets/js/emoji_modal.js?a=5"></script>
<style>
a.emojitab {

View File

@ -156,8 +156,7 @@
<a class="btn btn-primary" href="javascript:void(0)" onclick="toggleElement('profile-toggleable', 'bux-transfer')">Gift Marseybux</a>
{% if v.admin_level > 2 %}
<a id="admin" class="{% if u.admin_level > 1 %}d-none{% endif %} btn btn-primary" href="javascript:void(0)" onclick="post_toast2('/@{{u.username}}/make_admin','admin','unadmin')">Make admin</a>
<a id="unadmin" class="{% if u.admin_level < 2 %}d-none{% endif %} btn btn-primary" href="javascript:void(0)" onclick="post_toast2('/@{{u.username}}/remove_admin','admin','unadmin')">Remove admin</a>
<a id="unadmin" class="{% if u.admin_level < 2 %}d-none{% endif %} btn btn-primary" href="javascript:void(0)" onclick="post_toast('/@{{u.username}}/remove_admin')">Remove admin</a>
<a id="memeadmin" class="{% if u.admin_level == 1%}d-none{% endif %} btn btn-primary" href="javascript:void(0)" onclick="post_toast2('/@{{u.username}}/make_meme_admin','memeadmin','unmemeadmin')">Make meme admin</a>
<a id="unmemeadmin" class="{% if u.admin_level != 1 %}d-none{% endif %} btn btn-primary" href="javascript:void(0)" onclick="post_toast2('/@{{u.username}}/remove_meme_admin','memeadmin','unmemeadmin')">Remove meme admin</a>
@ -442,8 +441,7 @@
<a class="btn btn-primary" href="javascript:void(0)" onclick="toggleElement('profile-toggleable', 'bux-transfer-mobile')">Gift Marseybux</a>
{% if v.admin_level > 2 %}
<a id="admin2" class="{% if u.admin_level > 1 %}d-none{% endif %} btn btn-primary" href="javascript:void(0)" onclick="post_toast2('/@{{u.username}}/make_admin','admin2','unadmin2')">Make admin</a>
<a id="unadmin2" class="{% if u.admin_level < 2 %}d-none{% endif %} btn btn-primary" href="javascript:void(0)" onclick="post_toast2('/@{{u.username}}/remove_admin','admin2','unadmin2')">Remove admin</a>
<a id="unadmin2" class="{% if u.admin_level < 2 %}d-none{% endif %} btn btn-primary" href="javascript:void(0)" onclick="post_toast('/@{{u.username}}/remove_admin')">Remove admin</a>
<a id="memeadmin2" class="{% if u.admin_level == 1%}d-none{% endif %} btn btn-primary" href="javascript:void(0)" onclick="post_toast2('/@{{u.username}}/make_meme_admin','memeadmin2','unmemeadmin2')">Make meme admin</a>
<a id="unmemeadmin2" class="{% if u.admin_level != 1 %}d-none{% endif %} btn btn-primary" href="javascript:void(0)" onclick="post_toast2('/@{{u.username}}/remove_meme_admin','memeadmin2','unmemeadmin2')">Remove meme admin</a>

View File

@ -760,8 +760,6 @@ CREATE TABLE public.users (
teddit boolean,
bird integer,
fish boolean,
grinch boolean,
grincheffect boolean,
lootboxes_bought integer,
oldsite boolean,
theme2 character varying(30)