forked from rDrama/rDrama
Disable non-cosmetic awards on ghost posts.
Per poll result: https://rdrama.net/post/79285/-/3049889 Permits cosmetics and pin/unpin to be used; disables all others.master
parent
867f129b35
commit
8ab77eb0ee
|
@ -1244,6 +1244,12 @@ if SITE_NAME == 'PCM':
|
|||
}
|
||||
AWARDS.update(PCM_AWARDS)
|
||||
|
||||
# Permit only cosmetics and pin/unpin on ghosted things.
|
||||
for award in AWARDS:
|
||||
AWARDS[award]['ghost'] = AWARDS[award]['cosmetic']
|
||||
AWARDS['pin']['ghost'] = True
|
||||
AWARDS['unpin']['ghost'] = True
|
||||
|
||||
# Disable unused awards, and site-specific award inclusion/exclusion.
|
||||
AWARDS_DISABLED = [
|
||||
'ghost', 'nword', 'lootbox', # Generic
|
||||
|
@ -1317,7 +1323,6 @@ if not FEATURES['PROCOINS']:
|
|||
AWARDS_DISABLED.append('benefactor')
|
||||
|
||||
AWARDS2 = {x: AWARDS[x] for x in AWARDS if x not in AWARDS_DISABLED}
|
||||
AWARDS3 = {x: AWARDS2[x] for x in AWARDS2 if AWARDS2[x]['price'] <= 500}
|
||||
|
||||
DOUBLE_XP_ENABLED = -1 # set to unixtime for when DXP begins, -1 to disable
|
||||
|
||||
|
|
|
@ -167,6 +167,9 @@ def award_thing(v, thing_type, id):
|
|||
if kind == 'marsify' and author.marsify == 1:
|
||||
abort(403, "User is already permanently marsified!")
|
||||
|
||||
if thing.ghost and not AWARDS[kind]['ghost']:
|
||||
abort(403, "This kind of award can't be used on ghost posts.")
|
||||
|
||||
if v.id != author.id:
|
||||
safe_username = "👻" if thing.ghost else f"@{author.username}"
|
||||
|
||||
|
@ -264,7 +267,6 @@ def award_thing(v, thing_type, id):
|
|||
|
||||
badge_grant(user=author, badge_id=28)
|
||||
elif kind == "flairlock":
|
||||
if thing.ghost: abort(403)
|
||||
new_name = note[:100].replace("𒐪","")
|
||||
if not new_name and author.flairchanged:
|
||||
author.flairchanged += 86400
|
||||
|
|
Loading…
Reference in New Issue