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:
MelissaCole
2015-04-22 16:52:25 -07:00
parent c2d5ebe175
commit a30cc40f77
5 changed files with 12 additions and 28 deletions

View File

@@ -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')

View File

@@ -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)

View File

@@ -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

View File

@@ -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,

View File

@@ -340,24 +340,16 @@
<tr class="gold-accent">
<th>${_("gold options")}</th>
<td class="prefright">
${checkbox(_("show the right sidebar ad box"), "show_adbox")}
&#32;<span class="details">(${_("the attractive 300x250 one that usually only has reddit t-shirts in it")})</span>
<br/>
${checkbox(_("show sponsored links"), "show_sponsors")}
&#32;<span class="details">(${_("the blue advertisements that sometimes appear on the top of the page")})</span>
<br/>
${checkbox(_("show sponsorships"), "show_sponsorships")}
&#32;<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")}
&#32;<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")}
&#32;<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('&#32;<a href="/creddits">creddit</a>&#32;') %>
${checkbox(_wsf("use a %(creddit_link)s to automatically renew my gold if it expires", creddit_link=creddit_link), "creddit_autorenew")}
</td>