forked from rDrama/rDrama
remove weird variable
parent
aeb10e1ec6
commit
4dbc4096d3
|
@ -54,8 +54,7 @@ def vote_post_comment(target_id, new, v, cls, vote_cls):
|
||||||
else:
|
else:
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
||||||
target_author = target.author
|
if target.author.shadowbanned and not v.can_see_shadowbanned:
|
||||||
if target_author.shadowbanned and not v.can_see_shadowbanned:
|
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
||||||
coin_delta = 1
|
coin_delta = 1
|
||||||
|
@ -81,23 +80,23 @@ def vote_post_comment(target_id, new, v, cls, vote_cls):
|
||||||
if existing and existing.vote_type == new: return "", 204
|
if existing and existing.vote_type == new: return "", 204
|
||||||
if existing:
|
if existing:
|
||||||
if existing.vote_type == 0 and new != 0:
|
if existing.vote_type == 0 and new != 0:
|
||||||
target_author.coins += coin_value
|
target.author.coins += coin_value
|
||||||
target_author.truescore += coin_delta
|
target.author.truescore += coin_delta
|
||||||
g.db.add(target_author)
|
g.db.add(target.author)
|
||||||
existing.vote_type = new
|
existing.vote_type = new
|
||||||
existing.coins = coin_value
|
existing.coins = coin_value
|
||||||
g.db.add(existing)
|
g.db.add(existing)
|
||||||
elif existing.vote_type != 0 and new == 0:
|
elif existing.vote_type != 0 and new == 0:
|
||||||
target_author.charge_account('coins', existing.coins, should_check_balance=False)
|
target.author.charge_account('coins', existing.coins, should_check_balance=False)
|
||||||
target_author.truescore -= coin_delta
|
target.author.truescore -= coin_delta
|
||||||
g.db.add(target_author)
|
g.db.add(target.author)
|
||||||
g.db.delete(existing)
|
g.db.delete(existing)
|
||||||
else:
|
else:
|
||||||
existing.vote_type = new
|
existing.vote_type = new
|
||||||
g.db.add(existing)
|
g.db.add(existing)
|
||||||
elif new != 0:
|
elif new != 0:
|
||||||
target_author.coins += coin_value
|
target.author.coins += coin_value
|
||||||
target_author.truescore += coin_delta
|
target.author.truescore += coin_delta
|
||||||
g.db.add(target.author)
|
g.db.add(target.author)
|
||||||
|
|
||||||
real = new != 1 or v.is_votes_real
|
real = new != 1 or v.is_votes_real
|
||||||
|
|
Loading…
Reference in New Issue