Gilding: track "proxy gildings" in secret column

This commit is contained in:
Chad Birch
2014-09-03 19:09:27 -06:00
parent 6cbea2af34
commit 3b83d236c5
5 changed files with 14 additions and 4 deletions

View File

@@ -665,6 +665,8 @@ listing_chooser_explore_sr =
discovery_srs =
# historical cost to run a reddit server
pennies_per_server_second = 1970/1/1:1
# lowercased names of accounts that API clients use as "proxies" for gilding
proxy_gilding_accounts =
# Controversial item determination
# Criteria for an item to meet to be determined as controversial

View File

@@ -61,6 +61,10 @@ class APIv1GoldController(OAuth2ResourceController):
err = RedditError("INSUFFICIENT_CREDDITS")
self.on_validation_error(err)
note = None
if c.user.name.lower() in g.live_config["proxy_gilding_accounts"]:
note = "proxy"
send_gift(
buyer=c.user,
recipient=recipient,
@@ -69,6 +73,7 @@ class APIv1GoldController(OAuth2ResourceController):
signed=False,
giftmessage=None,
thing_fullname=thing_fullname,
note=note,
)
if not c.user.employee:

View File

@@ -239,7 +239,7 @@ def months_and_days_from_pennies(pennies, discount=False):
return (months, days)
def send_gift(buyer, recipient, months, days, signed, giftmessage,
thing_fullname):
thing_fullname, note=None):
admintools.engolden(recipient, days)
if thing_fullname:
@@ -255,7 +255,7 @@ def send_gift(buyer, recipient, months, days, signed, giftmessage,
sender = _("An anonymous redditor")
md_sender = _("An anonymous redditor")
create_gift_gold (buyer._id, recipient._id, days, c.start_time, signed)
create_gift_gold(buyer._id, recipient._id, days, c.start_time, signed, note)
if months == 1:
amount = "a month"

View File

@@ -293,6 +293,7 @@ class Globals(object):
'fastlane_links',
'listing_chooser_sample_multis',
'discovery_srs',
'proxy_gilding_accounts',
],
ConfigValue.str: [
'listing_chooser_gold_multi',

View File

@@ -276,7 +276,7 @@ def create_claimed_gold (trans_id, payer_email, paying_id,
account_id=account_id,
date=date)
def create_gift_gold (giver_id, recipient_id, days, date, signed):
def create_gift_gold (giver_id, recipient_id, days, date, signed, note=None):
trans_id = "X%d%s-%s" % (int(time()), randstr(2), 'S' if signed else 'A')
gold_table.insert().execute(trans_id=trans_id,
@@ -286,7 +286,9 @@ def create_gift_gold (giver_id, recipient_id, days, date, signed):
pennies=0,
days=days,
account_id=recipient_id,
date=date)
date=date,
secret=note,
)
def create_gold_code(trans_id, payer_email, paying_id, pennies, days, date):