diff --git a/r2/r2/controllers/listingcontroller.py b/r2/r2/controllers/listingcontroller.py index ed114cb06..9caaf9185 100755 --- a/r2/r2/controllers/listingcontroller.py +++ b/r2/r2/controllers/listingcontroller.py @@ -345,6 +345,9 @@ class HotController(ListingWithPromos): @classmethod def trending_info(cls): + if not c.user.pref_show_trending: + return None + trending_data = trending.get_trending_subreddits() if not trending_data: diff --git a/r2/r2/lib/validator/preferences.py b/r2/r2/lib/validator/preferences.py index 8826df434..712ba0f78 100644 --- a/r2/r2/lib/validator/preferences.py +++ b/r2/r2/lib/validator/preferences.py @@ -66,6 +66,7 @@ PREFS_VALIDATORS = dict( pref_show_adbox=VBoolean("show_adbox"), pref_show_sponsors=VBoolean("show_sponsors"), pref_show_sponsorships=VBoolean("show_sponsorships"), + pref_show_trending=VBoolean("show_trending"), pref_highlight_new_comments=VBoolean("highlight_new_comments"), pref_monitor_mentions=VBoolean("monitor_mentions"), ) diff --git a/r2/r2/models/account.py b/r2/r2/models/account.py index 446c1b0ba..5b9befd19 100644 --- a/r2/r2/models/account.py +++ b/r2/r2/models/account.py @@ -93,6 +93,7 @@ class Account(Thing): pref_show_adbox = True, pref_show_sponsors = True, # sponsored links pref_show_sponsorships = True, + pref_show_trending=True, pref_highlight_new_comments = True, pref_monitor_mentions=True, pref_collapse_left_bar=False, diff --git a/r2/r2/templates/prefoptions.html b/r2/r2/templates/prefoptions.html index 9bc5dddb8..f5a71b8a6 100644 --- a/r2/r2/templates/prefoptions.html +++ b/r2/r2/templates/prefoptions.html @@ -144,6 +144,14 @@

${checkbox(_("show me new links on the front page"), "organic")}

%endif +

+ ${checkbox(_("show trending subreddits on the front page"), "show_trending")} + + + ${_("(a list of popular and notable subreddits to check out)")} + +

+

${checkbox(_("show me links I've recently viewed"), "clickgadget")}

${checkbox(_("compress the link display"), "compress")}

${checkbox(_("show additional details in the domain text when available"), "domain_details")}