Create /subreddits/quarantine

This lists all of the subreddits that have been quarantined.
This commit is contained in:
MelissaCole
2015-07-21 12:42:14 -07:00
committed by Florence Yeun
parent 6c76c86817
commit 68ed9767d8
4 changed files with 16 additions and 2 deletions

View File

@@ -87,8 +87,7 @@ def make_map():
mc('/subreddits/login', controller='forms', action='login')
mc('/subreddits/:where', controller='reddits', action='listing',
where='popular', conditions={'function':not_in_sr},
requirements=dict(where="popular|new|banned|employee|gold|default"))
requirements=dict(where="popular|new|banned|employee|gold|default|quarantine"))
# If no subreddit is specified, might as well show a list of 'em.
mc('/r', controller='redirect', action='redirect', dest='/subreddits')

View File

@@ -1322,6 +1322,18 @@ class RedditsController(ListingController):
stale=True,
)
reddits._sort = desc('_downs')
elif self.where == 'quarantine':
if c.user_is_admin:
reddits = Subreddit._query(
Subreddit.c.quarantine==True,
write_cache=True,
read_cache=True,
cache_time=5 * 60,
stale=True,
)
reddits._sort = desc('_downs')
else:
abort(404)
elif self.where == 'gold':
reddits = Subreddit._query(
Subreddit.c.type=='gold_only',

View File

@@ -147,6 +147,7 @@ menu = MenuHandler(hot = _('hot'),
popular = _("popular"),
create = _("create"),
mine = _("my subreddits"),
quarantine = _("quarantine"),
i18n = _("help translate"),
errors = _("errors"),

View File

@@ -2059,6 +2059,8 @@ class SubredditsPage(Reddit):
buttons.append(NamedButton("employee"))
if c.user.gold or c.user.gold_charter:
buttons.append(NamedButton("gold"))
if c.user_is_admin:
buttons.append(NamedButton("quarantine"))
if c.user_is_loggedin:
#add the aliases to "my reddits" stays highlighted
buttons.append(NamedButton("mine",