mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-04-27 03:00:12 -04:00
Add '/subreddits/default.json' endpoint
For loading the default subreddits.
This commit is contained in:
@@ -86,7 +86,7 @@ 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"))
|
||||
where='popular', 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')
|
||||
|
||||
|
||||
@@ -1297,6 +1297,12 @@ class RedditsController(ListingController):
|
||||
stale=True,
|
||||
)
|
||||
reddits._sort = desc('_downs')
|
||||
elif self.where == 'default':
|
||||
return [
|
||||
sr._fullname
|
||||
for sr in Subreddit.default_subreddits(ids=False)
|
||||
if sr.author_id is not -1
|
||||
]
|
||||
else:
|
||||
reddits = Subreddit._query( write_cache = True,
|
||||
read_cache = True,
|
||||
@@ -1321,6 +1327,7 @@ class RedditsController(ListingController):
|
||||
'/subreddits/new',
|
||||
'/subreddits/employee',
|
||||
'/subreddits/gold',
|
||||
'/subreddits/default',
|
||||
])
|
||||
def GET_listing(self, where, **env):
|
||||
"""Get all subreddits.
|
||||
|
||||
Reference in New Issue
Block a user