mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-04-27 03:00:12 -04:00
Gilding: track "proxy gildings" in secret column
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -293,6 +293,7 @@ class Globals(object):
|
||||
'fastlane_links',
|
||||
'listing_chooser_sample_multis',
|
||||
'discovery_srs',
|
||||
'proxy_gilding_accounts',
|
||||
],
|
||||
ConfigValue.str: [
|
||||
'listing_chooser_gold_multi',
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user