diff --git a/r2/example.ini b/r2/example.ini index 3b6680bd8..b31ac3e6b 100644 --- a/r2/example.ini +++ b/r2/example.ini @@ -496,3 +496,5 @@ beaker.session_secret = somesecret [live_config] # make frontpage 100% dart frontpage_dart = false +# spotlight links for subreddit discovery +sr_discovery_links = diff --git a/r2/r2/controllers/listingcontroller.py b/r2/r2/controllers/listingcontroller.py index cc49e16d1..802e48b1d 100755 --- a/r2/r2/controllers/listingcontroller.py +++ b/r2/r2/controllers/listingcontroller.py @@ -269,8 +269,8 @@ class HotController(FixListing, ListingController): # If prefs allow it, mix in promoted links and sr discovery content if c.user.pref_show_sponsors or not c.user.gold: - if hasattr(g, 'sr_discovery_links'): - spotlight_links.extend(g.sr_discovery_links) + if g.live_config['sr_discovery_links']: + spotlight_links.extend(g.live_config['sr_discovery_links']) random.shuffle(spotlight_links) spotlight_keep_fn = lambda l: promote.is_promo(l) or organic.keep_fresh_links(l) num_links = len(spotlight_links) diff --git a/r2/r2/controllers/validator/validator.py b/r2/r2/controllers/validator/validator.py index 0b747a4d9..9c9b02082 100644 --- a/r2/r2/controllers/validator/validator.py +++ b/r2/r2/controllers/validator/validator.py @@ -53,7 +53,7 @@ def visible_promo(article): c.user._id == article.author_id) # subreddit discovery links are visible even without a live campaign - if article._fullname in getattr(g, 'sr_discovery_links', {}): + if article._fullname in g.live_config['sr_discovery_links']: return True # promos are visible only if comments are not disabled and the diff --git a/r2/r2/lib/app_globals.py b/r2/r2/lib/app_globals.py index d0678353d..d259b3751 100755 --- a/r2/r2/lib/app_globals.py +++ b/r2/r2/lib/app_globals.py @@ -162,7 +162,6 @@ class Globals(object): 'allowed_pay_countries', 'case_sensitive_domains', 'reserved_subdomains', - 'sr_discovery_links' ], ConfigValue.choice: { @@ -181,6 +180,9 @@ class Globals(object): ConfigValue.bool: [ 'frontpage_dart', ], + ConfigValue.tuple: [ + 'sr_discovery_links', + ], } def __init__(self, global_conf, app_conf, paths, **extra):