mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-04-27 03:00:12 -04:00
Consolidate gold ad preferences into one
This moves the 3 ad preferences (300x100, 300x250, and sponsors) into 1 preference (hide ads) for simplicity.
This commit is contained in:
@@ -340,7 +340,7 @@ class ListingWithPromos(SubredditListingController):
|
||||
|
||||
show_promo = False
|
||||
srnames = []
|
||||
can_show_promo = c.user.pref_show_sponsors or not c.user.gold
|
||||
can_show_promo = not c.user.pref_hide_ads or not c.user.gold
|
||||
try_show_promo = ((c.user_is_loggedin and random.random() > 0.5) or
|
||||
not c.user_is_loggedin)
|
||||
|
||||
@@ -381,7 +381,7 @@ class ListingWithPromos(SubredditListingController):
|
||||
# only send a spotlight listing for HTML rendering
|
||||
if c.render_style == "html":
|
||||
spotlight = None
|
||||
show_sponsors = not (not c.user.pref_show_sponsors and c.user.gold)
|
||||
show_sponsors = not c.user.pref_hide_ads or not c.user.gold
|
||||
show_organic = self.show_organic and c.user.pref_organic
|
||||
on_frontpage = isinstance(c.site, DefaultSR)
|
||||
requested_ad = request.GET.get('ad')
|
||||
|
||||
@@ -526,7 +526,7 @@ class Reddit(Templated):
|
||||
notebar = AdminNotesSidebar('subreddit', c.site.name)
|
||||
ps.append(notebar)
|
||||
|
||||
if c.user.pref_show_sponsorships or not c.user.gold:
|
||||
if not c.user.pref_hide_ads or not c.user.gold:
|
||||
ps.append(SponsorshipBox())
|
||||
|
||||
if (isinstance(c.site, Filtered) and not
|
||||
@@ -631,7 +631,7 @@ class Reddit(Templated):
|
||||
show_cover=True))
|
||||
|
||||
no_ads_yet = True
|
||||
user_disabled_ads = c.user.gold and not c.user.pref_show_adbox
|
||||
user_disabled_ads = c.user.gold and c.user.pref_hide_ads
|
||||
sr_disabled_ads = (not isinstance(c.site, FakeSubreddit) and
|
||||
c.site.type == "gold_only" and
|
||||
c.site.hide_ads)
|
||||
|
||||
@@ -72,9 +72,7 @@ PREFS_VALIDATORS = dict(
|
||||
pref_email_messages=VBoolean("email_messages"),
|
||||
pref_private_feeds=VBoolean("private_feeds"),
|
||||
pref_store_visits=VBoolean('store_visits'),
|
||||
pref_show_adbox=VBoolean("show_adbox"),
|
||||
pref_show_sponsors=VBoolean("show_sponsors"),
|
||||
pref_show_sponsorships=VBoolean("show_sponsorships"),
|
||||
pref_hide_ads=VBoolean("hide_ads"),
|
||||
pref_show_trending=VBoolean("show_trending"),
|
||||
pref_highlight_new_comments=VBoolean("highlight_new_comments"),
|
||||
pref_monitor_mentions=VBoolean("monitor_mentions"),
|
||||
@@ -125,13 +123,9 @@ def filter_prefs(prefs, user):
|
||||
if prefs.get("pref_no_profanity") or user.pref_no_profanity:
|
||||
prefs['pref_label_nsfw'] = True
|
||||
|
||||
# default all the gold options to on if they don't have gold
|
||||
# don't update the hide_ads pref if they don't have gold
|
||||
if not user.gold:
|
||||
for pref in ('pref_show_adbox',
|
||||
'pref_show_sponsors',
|
||||
'pref_show_sponsorships',
|
||||
):
|
||||
prefs[pref] = True
|
||||
del prefs['pref_hide_ads']
|
||||
|
||||
if not (user.gold or user.is_moderator_somewhere):
|
||||
prefs['pref_highlight_new_comments'] = True
|
||||
|
||||
@@ -102,9 +102,7 @@ class Account(Thing):
|
||||
pref_email_messages = False,
|
||||
pref_private_feeds = True,
|
||||
pref_force_https = False,
|
||||
pref_show_adbox = True,
|
||||
pref_show_sponsors = True, # sponsored links
|
||||
pref_show_sponsorships = True,
|
||||
pref_hide_ads = False,
|
||||
pref_show_trending=True,
|
||||
pref_highlight_new_comments = True,
|
||||
pref_monitor_mentions=True,
|
||||
|
||||
@@ -340,24 +340,16 @@
|
||||
<tr class="gold-accent">
|
||||
<th>${_("gold options")}</th>
|
||||
<td class="prefright">
|
||||
${checkbox(_("show the right sidebar ad box"), "show_adbox")}
|
||||
 <span class="details">(${_("the attractive 300x250 one that usually only has reddit t-shirts in it")})</span>
|
||||
<br/>
|
||||
${checkbox(_("show sponsored links"), "show_sponsors")}
|
||||
 <span class="details">(${_("the blue advertisements that sometimes appear on the top of the page")})</span>
|
||||
<br/>
|
||||
${checkbox(_("show sponsorships"), "show_sponsorships")}
|
||||
 <span class="details">(${_("the 300x100 'sponsored by...' images that sometimes appear in sidebars")})</span>
|
||||
<br/>
|
||||
${checkbox(_("hide ads"), "hide_ads")}
|
||||
<br>
|
||||
${checkbox(_("remember what links I've visited"), "store_visits")}
|
||||
 <span class="details">(${_("we'll remember and mark what links you've already read, even between computers")})</span>
|
||||
<br/>
|
||||
<br/>
|
||||
<br>
|
||||
${checkbox(_("highlight new comments"), "highlight_new_comments")}
|
||||
 <span class="details">
|
||||
(${_("we'll remember your visits for 48 hours and show you which comments you haven't seen yet")})
|
||||
</span>
|
||||
<br><br>
|
||||
<br>
|
||||
<% creddit_link = unsafe(' <a href="/creddits">creddit</a> ') %>
|
||||
${checkbox(_wsf("use a %(creddit_link)s to automatically renew my gold if it expires", creddit_link=creddit_link), "creddit_autorenew")}
|
||||
</td>
|
||||
|
||||
Reference in New Issue
Block a user