use AllMinusBox for goldies, InfoBar warning for non-goldies

This commit is contained in:
bsimpson63
2012-11-20 09:53:30 -05:00
parent c2726851b5
commit 3e7df834d7
2 changed files with 13 additions and 12 deletions

View File

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

View File

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