From 3e7df834d7204d50bcaa10123bd6b2125618cf62 Mon Sep 17 00:00:00 2001 From: bsimpson63 Date: Tue, 20 Nov 2012 09:53:30 -0500 Subject: [PATCH] use AllMinusBox for goldies, InfoBar warning for non-goldies --- r2/r2/lib/pages/pages.py | 24 ++++++++++++------------ r2/r2/lib/strings.py | 1 + 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/r2/r2/lib/pages/pages.py b/r2/r2/lib/pages/pages.py index 320f40d76..818d99e75 100755 --- a/r2/r2/lib/pages/pages.py +++ b/r2/r2/lib/pages/pages.py @@ -187,6 +187,10 @@ class Reddit(Templated): if infotext: self.infobar = InfoBar(message = infotext) + if isinstance(c.site, AllMinus) and not c.user.gold: + if not self.infobar: + self.infobar = InfoBar(message=strings.all_minus_gold_only) + self.srtopbar = None if srbar and not c.cname and not is_api(): self.srtopbar = SubredditTopBar() @@ -319,8 +323,8 @@ class Reddit(Templated): box = SubscriptionBox(srs) ps.append(SideContentBox(_('these subreddits'), [box])) - if (isinstance(c.site, AllMinus) or - isinstance(c.site, AllSR) and c.user.gold): + if ((isinstance(c.site, AllMinus) or isinstance(c.site, AllSR)) and + c.user.gold): ps.append(AllMinusBox(c.user)) # don't show the subreddit info bar on cnames unless the option is set @@ -1701,16 +1705,12 @@ class SubscriptionBox(Templated): class AllMinusBox(Templated): def __init__(self, user): - if user.gold: - sr_ids = Subreddit.user_subreddits(user) - srs = Subreddit._byID(sr_ids, data=True, return_dict=False) - path = '/r/all' - if srs: - path += '-' + '-'.join([sr.name for sr in srs]) - text = _('See /r/all minus your subscribed subreddits') - else: - path = '/gold' - text = _('/r/all filtering is a gold only feature') + sr_ids = Subreddit.user_subreddits(user) + srs = Subreddit._byID(sr_ids, data=True, return_dict=False) + path = '/r/all' + if srs: + path += '-' + '-'.join([sr.name for sr in srs]) + text = _('See /r/all minus your subscribed subreddits') Templated.__init__(self, text=text, path=path) diff --git a/r2/r2/lib/strings.py b/r2/r2/lib/strings.py index 5621e730b..25ed095f7 100644 --- a/r2/r2/lib/strings.py +++ b/r2/r2/lib/strings.py @@ -183,6 +183,7 @@ Note: there are a couple of places outside of your subreddit where someone can c rate_limit = _("please wait a few seconds and try again."), subscribed_multi = _("multireddit of your subscriptions"), mod_multi = _("multireddit of subreddits you moderate"), + all_minus_gold_only = _('/r/all filtering is a [gold only feature](/help/gold)'), ) class StringHandler(object):