From 3cdc8169ef9f4ae3753af7e1ca278f15a3baefbb Mon Sep 17 00:00:00 2001 From: Brian Simpson Date: Fri, 10 Jul 2015 16:55:48 -0400 Subject: [PATCH] Don't allow /subreddits listing within a subreddit. E.g. /r/funny/subreddits. --- r2/r2/config/routing.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/r2/r2/config/routing.py b/r2/r2/config/routing.py index 49b6f9e25..8deeca290 100644 --- a/r2/r2/config/routing.py +++ b/r2/r2/config/routing.py @@ -86,12 +86,14 @@ def make_map(): mc('/subreddits/search', controller='front', action='search_reddits') mc('/subreddits/login', controller='forms', action='login') mc('/subreddits/:where', controller='reddits', action='listing', - where='popular', requirements=dict(where="popular|new|banned|employee|gold|default")) + where='popular', conditions={'function':not_in_sr}, + requirements=dict(where="popular|new|banned|employee|gold|default")) + # If no subreddit is specified, might as well show a list of 'em. mc('/r', controller='redirect', action='redirect', dest='/subreddits') mc('/subreddits/mine/:where', controller='myreddits', action='listing', - where='subscriber', + where='subscriber', conditions={'function':not_in_sr}, requirements=dict(where='subscriber|contributor|moderator')) # These routes are kept for backwards-compatibility reasons @@ -100,10 +102,11 @@ def make_map(): mc('/reddits/search', controller='front', action='search_reddits') mc('/reddits/login', controller='forms', action='login') mc('/reddits/:where', controller='reddits', action='listing', - where='popular', requirements=dict(where="popular|new|banned")) + where='popular', conditions={'function':not_in_sr}, + requirements=dict(where="popular|new|banned")) mc('/reddits/mine/:where', controller='myreddits', action='listing', - where='subscriber', + where='subscriber', conditions={'function':not_in_sr}, requirements=dict(where='subscriber|contributor|moderator')) mc('/buttons', controller='buttons', action='button_demo_page')