This commit is contained in:
Aevann1 2021-12-27 03:08:06 +02:00
parent 6b842f92cf
commit b18fa7be39
12 changed files with 18 additions and 57 deletions

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