forked from rDrama/rDrama
make deflector apply to "shit" and "unpin" award
parent
993dd16d57
commit
d1f8162873
|
@ -562,12 +562,12 @@ class User(Base):
|
|||
@property
|
||||
@lazy
|
||||
def awards_content_effect(self):
|
||||
return [x for x in self.user_awards if not x['deflectable'] and x['kind'] != 'benefactor']
|
||||
return [x for x in self.user_awards if x['cosmetic'] or x['kind'] in {"pin", "unpin"}]
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def awards_author_effect(self):
|
||||
return [x for x in self.user_awards if x not in self.awards_content_effect]
|
||||
return [x for x in self.user_awards if not x['cosmetic'] and x['kind'] not in {"pin", "unpin"}]
|
||||
|
||||
@property
|
||||
@lazy
|
||||
|
|
|
@ -431,7 +431,7 @@ AWARDS = {
|
|||
"icon": "fas fa-poop",
|
||||
"color": "text-black-50",
|
||||
"price": 300,
|
||||
"deflectable": False,
|
||||
"deflectable": True,
|
||||
"cosmetic": True,
|
||||
"ghost": True,
|
||||
"enabled": True,
|
||||
|
@ -639,7 +639,7 @@ AWARDS = {
|
|||
"icon": "fas fa-thumbtack fa-rotate--45",
|
||||
"color": "text-black",
|
||||
"price": 1000,
|
||||
"deflectable": False,
|
||||
"deflectable": True,
|
||||
"cosmetic": False,
|
||||
"ghost": True,
|
||||
"enabled": True,
|
||||
|
|
|
@ -209,6 +209,11 @@ def award_thing(v, thing_type, id):
|
|||
send_repeatable_notification(v.id, msg)
|
||||
author = v
|
||||
safe_username = f"Your award has been deflected but failed since you're"
|
||||
|
||||
if kind == 'shit':
|
||||
awarded_coins = int(AWARDS[kind]['price'] * COSMETIC_AWARD_COIN_AWARD_PCT)
|
||||
v.charge_account('coins', awarded_coins, should_check_balance=False)
|
||||
thing.author.pay_account('coins', awarded_coins)
|
||||
elif kind != 'spider':
|
||||
if AWARDS[kind]['cosmetic']:
|
||||
awarded_coins = int(AWARDS[kind]['price'] * COSMETIC_AWARD_COIN_AWARD_PCT)
|
||||
|
@ -309,6 +314,7 @@ def award_thing(v, thing_type, id):
|
|||
cache.delete_memoized(frontlist)
|
||||
elif kind == "unpin":
|
||||
if not thing.stickied_utc: abort(400)
|
||||
if not thing.author.deflector:
|
||||
if thing.author_id == LAWLZ_ID and SITE_NAME == 'rDrama': abort(403, "You can't unpin lawlzposts!")
|
||||
|
||||
if thing_type == 'comment':
|
||||
|
|
Loading…
Reference in New Issue