diff --git a/r2/r2/config/middleware.py b/r2/r2/config/middleware.py index 214be45a7..bf495ffaf 100644 --- a/r2/r2/config/middleware.py +++ b/r2/r2/config/middleware.py @@ -206,7 +206,7 @@ class SubredditMiddleware(object): if sr: environ['subreddit'] = sr.groups()[0] environ['PATH_INFO'] = self.sr_pattern.sub('', path) or '/' - elif path.startswith("/reddits"): + elif path.startswith(('/subreddits', '/reddits')): environ['subreddit'] = 'r' return self.app(environ, start_response) diff --git a/r2/r2/config/routing.py b/r2/r2/config/routing.py index 4348501a8..383bcedd0 100644 --- a/r2/r2/config/routing.py +++ b/r2/r2/config/routing.py @@ -68,6 +68,18 @@ def make_map(): mc('/about/:location', controller='front', action='editreddit', location='about') + mc('/subreddits/create', controller='front', action='newreddit') + 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")) + + mc('/subreddits/mine/:where', controller='myreddits', action='listing', + where='subscriber', + requirements=dict(where='subscriber|contributor|moderator')) + + # These routes are kept for backwards-compatibility reasons + # Using the above /subreddits/ ones instead is preferable mc('/reddits/create', controller='front', action='newreddit') mc('/reddits/search', controller='front', action='search_reddits') mc('/reddits/login', controller='forms', action='login') diff --git a/r2/r2/controllers/front.py b/r2/r2/controllers/front.py index fe88ad0b1..d692b21a9 100755 --- a/r2/r2/controllers/front.py +++ b/r2/r2/controllers/front.py @@ -381,10 +381,10 @@ class FrontController(RedditController, OAuth2ResourceController): @validate(VUser(), name=nop('name')) def GET_newreddit(self, name): - """Create a community form""" - title = _('create a reddit') + """Create a subreddit form""" + title = _('create a subreddit') content=CreateSubreddit(name=name or '') - res = FormPage(_("create a community"), + res = FormPage(_("create a subreddit"), content=content, ).render() return res @@ -785,7 +785,7 @@ class FrontController(RedditController, OAuth2ResourceController): @base_listing @validate(query=nop('q')) - @api_doc(api_section.subreddits, uri='/reddits/search', extensions=['json', 'xml']) + @api_doc(api_section.subreddits, uri='/subreddits/search', extensions=['json', 'xml']) def GET_search_reddits(self, query, reverse, after, count, num): """Search reddits by title and description.""" q = SubredditSearchQuery(query) diff --git a/r2/r2/controllers/listingcontroller.py b/r2/r2/controllers/listingcontroller.py index a2dfe549d..d8c94c4de 100755 --- a/r2/r2/controllers/listingcontroller.py +++ b/r2/r2/controllers/listingcontroller.py @@ -924,7 +924,7 @@ class RedditsController(ListingController): render_cls = SubredditsPage def title(self): - return _('reddits') + return _('subreddits') def keep_fn(self): base_keep_fn = ListingController.keep_fn(self) @@ -965,8 +965,8 @@ class RedditsController(ListingController): return reddits @listing_api_doc(section=api_section.subreddits, - uri='/reddits/{where}', - uri_variants=['/reddits/popular', '/reddits/new', '/reddits/banned']) + uri='/subreddits/{where}', + uri_variants=['/subreddits/popular', '/subreddits/new', '/subreddits/banned']) def GET_listing(self, where, **env): self.where = where return ListingController.GET_listing(self, **env) @@ -984,11 +984,11 @@ class MyredditsController(ListingController, OAuth2ResourceController): NavButton(getattr(plurals, "approved submitter"), 'contributor'), NavButton(plurals.moderator, 'moderator')) - return [NavMenu(buttons, base_path = '/reddits/mine/', + return [NavMenu(buttons, base_path = '/subreddits/mine/', default = 'subscriber', type = "flatlist")] def title(self): - return _('reddits: ') + self.where + return _('subreddits: ') + self.where def query(self): reddits = SRMember._query(SRMember.c._name == self.where, @@ -1030,8 +1030,8 @@ class MyredditsController(ListingController, OAuth2ResourceController): @require_oauth2_scope("mysubreddits") @validate(VUser()) @listing_api_doc(section=api_section.subreddits, - uri='/reddits/mine/{where}', - uri_variants=['/reddits/mine/subscriber', '/reddits/mine/contributor', '/reddits/mine/moderator']) + uri='/subreddits/mine/{where}', + uri_variants=['/subreddits/mine/subscriber', '/subreddits/mine/contributor', '/subreddits/mine/moderator']) def GET_listing(self, where='subscriber', **env): self.where = where return ListingController.GET_listing(self, **env) diff --git a/r2/r2/controllers/reddit_base.py b/r2/r2/controllers/reddit_base.py index 537f61d7d..cc9912e73 100644 --- a/r2/r2/controllers/reddit_base.py +++ b/r2/r2/controllers/reddit_base.py @@ -343,7 +343,7 @@ def set_subreddit(): elif '-' in sr_name: sr_names = sr_name.split('-') if not sr_names[0].lower() == All.name.lower(): - redirect_to("/reddits/search?q=%s" % sr_name) + redirect_to("/subreddits/search?q=%s" % sr_name) srs = Subreddit._by_name(sr_names[1:], stale=can_stale).values() srs = [sr for sr in srs if not isinstance(sr, FakeSubreddit)] if not srs: @@ -356,7 +356,7 @@ def set_subreddit(): except NotFound: sr_name = chksrname(sr_name) if sr_name: - redirect_to("/reddits/search?q=%s" % sr_name) + redirect_to("/subreddits/search?q=%s" % sr_name) elif not c.error_page and not request.path.startswith("/api/login/") : abort(404) diff --git a/r2/r2/lib/errors.py b/r2/r2/lib/errors.py index 72b6e07c4..dbdc0ead4 100644 --- a/r2/r2/lib/errors.py +++ b/r2/r2/lib/errors.py @@ -61,8 +61,8 @@ error_list = dict(( ('BAD_STRING', _("you used a character here that we can't handle")), ('BAD_BID', _("your bid must be at least $%(min)d per day and no more than to $%(max)d in total.")), ('ALREADY_SUB', _("that link has already been submitted")), - ('SUBREDDIT_EXISTS', _('that reddit already exists')), - ('SUBREDDIT_NOEXIST', _('that reddit doesn\'t exist')), + ('SUBREDDIT_EXISTS', _('that subreddit already exists')), + ('SUBREDDIT_NOEXIST', _('that subreddit doesn\'t exist')), ('SUBREDDIT_NOTALLOWED', _("you aren't allowed to post there.")), ('SUBREDDIT_REQUIRED', _('you must specify a subreddit')), ('BAD_SR_NAME', _('that name isn\'t going to work')), @@ -79,7 +79,7 @@ error_list = dict(( ('BAD_EMAILS', _('the following emails are invalid: %(emails)s')), ('NO_EMAILS', _('please enter at least one email address')), ('TOO_MANY_EMAILS', _('please only share to %(num)s emails at a time.')), - ('OVERSOLD', _('that reddit has already been oversold on %(start)s to %(end)s. Please pick another reddit or date.')), + ('OVERSOLD', _('that subreddit has already been oversold on %(start)s to %(end)s. Please pick another subreddit or date.')), ('BAD_DATE', _('please provide a date of the form mm/dd/yyyy')), ('BAD_DATE_RANGE', _('the dates need to be in order and not identical')), ('DATE_RANGE_TOO_LARGE', _('you must choose a date range of less than %(days)s days')), @@ -91,8 +91,8 @@ error_list = dict(( ('NO_TEXT', _('we need something here')), ('INVALID_CODE', _("we've never seen that code before")), ('CLAIMED_CODE', _("that code has already been claimed -- perhaps by you?")), - ('NO_SELFS', _("that reddit doesn't allow text posts")), - ('NO_LINKS', _("that reddit only allows text posts")), + ('NO_SELFS', _("that subreddit doesn't allow text posts")), + ('NO_LINKS', _("that subreddit only allows text posts")), ('TOO_OLD', _("that's a piece of history now; it's too late to reply to it")), ('BAD_CSS_NAME', _('invalid css name')), ('BAD_CSS', _('invalid css')), diff --git a/r2/r2/lib/jsontemplates.py b/r2/r2/lib/jsontemplates.py index 21d85eab8..4693d258a 100755 --- a/r2/r2/lib/jsontemplates.py +++ b/r2/r2/lib/jsontemplates.py @@ -236,7 +236,7 @@ class SubredditJsonTemplate(ThingJsonTemplate): if (attr == "_ups" and g.lounge_reddit and thing.name == g.lounge_reddit): return 0 - # Don't return accounts_active counts in /reddits + # Don't return accounts_active counts in /subreddits elif (attr == "accounts_active" and isinstance(c.site, SubSR)): return None elif attr == 'description_html': diff --git a/r2/r2/lib/menus.py b/r2/r2/lib/menus.py index 4e8350ddc..3648d00e3 100644 --- a/r2/r2/lib/menus.py +++ b/r2/r2/lib/menus.py @@ -118,7 +118,7 @@ menu = MenuHandler(hot = _('hot'), home = _("home"), about = _("about"), edit_subscriptions = _("edit subscriptions"), - community_settings = _("community settings"), + community_settings = _("subreddit settings"), moderators = _("edit moderators"), modmail = _("moderator mail"), contributors = _("edit approved submitters"), @@ -137,7 +137,7 @@ menu = MenuHandler(hot = _('hot'), popular = _("popular"), create = _("create"), - mine = _("my reddits"), + mine = _("my subreddits"), i18n = _("help translate"), errors = _("errors"), diff --git a/r2/r2/lib/pages/pages.py b/r2/r2/lib/pages/pages.py index 7c1fff1db..19509a4ce 100755 --- a/r2/r2/lib/pages/pages.py +++ b/r2/r2/lib/pages/pages.py @@ -397,8 +397,8 @@ class Reddit(Templated): if self.create_reddit_box and c.user_is_loggedin: delta = datetime.datetime.now(g.tz) - c.user._date if delta.days >= g.min_membership_create_community: - ps.append(SideBox(_('Create your own community'), - '/reddits/create', 'create', + ps.append(SideBox(_('Create your own subreddit'), + '/subreddits/create', 'create', subtitles = rand_strings.get("create_reddit", 2), show_cover = True, nocname=True)) @@ -1376,12 +1376,12 @@ class SubredditsPage(Reddit): if c.user_is_loggedin: #add the aliases to "my reddits" stays highlighted buttons.append(NamedButton("mine", - aliases=['/reddits/mine/subscriber', - '/reddits/mine/contributor', - '/reddits/mine/moderator'])) + aliases=['/subreddits/mine/subscriber', + '/subreddits/mine/contributor', + '/subreddits/mine/moderator'])) - return [PageNameNav('reddits'), - NavMenu(buttons, base_path = '/reddits', type="tabmenu")] + return [PageNameNav('subreddits'), + NavMenu(buttons, base_path = '/subreddits', type="tabmenu")] def content(self): return self.content_stack((self.interestbar, self.searchbar, @@ -1395,7 +1395,7 @@ class SubredditsPage(Reddit): subscribe_box = SubscriptionBox(srs, multi_text=strings.subscribed_multi) num_reddits = len(subscribe_box.srs) - ps.append(SideContentBox(_("your front page reddits (%s)") % + ps.append(SideContentBox(_("your front page subreddits (%s)") % num_reddits, [subscribe_box])) return ps @@ -1656,9 +1656,9 @@ class SubredditTopBar(CachedTemplate): drop_down_buttons.append(NavButton(menu.edit_subscriptions, sr_path = False, css_class = 'bottom-option', - dest = '/reddits/')) + dest = '/subreddits/')) return SubredditMenu(drop_down_buttons, - title = _('my reddits'), + title = _('my subreddits'), type = 'srdrop') def subscribed_reddits(self): @@ -1744,7 +1744,7 @@ class SubscriptionBox(Templated): Subreddit.gold_limit - Subreddit.sr_limit) visible = min(len(srs), Subreddit.gold_limit) bonus = {"bonus": extra} - self.goldmsg = _("%(bonus)s bonus reddits") % bonus + self.goldmsg = _("%(bonus)s bonus subreddits") % bonus self.prelink = ["/wiki/faq#wiki_how_many_reddits_can_i_subscribe_to.3F", _("%s visible") % visible] @@ -2050,7 +2050,7 @@ class SearchForm(Templated): class SearchBar(Templated): - """More detailed search box for /search and /reddits pages. + """More detailed search box for /search and /subreddits pages. Displays the previous search as well as info of the elapsed_time and num_results if any.""" def __init__(self, header=None, num_results=0, prev_search='', diff --git a/r2/r2/lib/strings.py b/r2/r2/lib/strings.py index 0d3fe2cc2..aeda8f855 100644 --- a/r2/r2/lib/strings.py +++ b/r2/r2/lib/strings.py @@ -68,7 +68,7 @@ string_dict = dict( already_submitted = _("that link has already been submitted, but you can try to [submit it again](%s)."), - multiple_submitted = _("that link has been submitted to multiple reddits. you can try to [submit it again](%s)."), + multiple_submitted = _("that link has been submitted to multiple subreddits. you can try to [submit it again](%s)."), user_deleted = _("your account has been deleted, but we won't judge you for it."), @@ -84,21 +84,21 @@ string_dict = dict( friends = _('to view reddit with only submissions from your friends, use [reddit.com/r/friends](%s)'), - sr_created = _('your reddit has been created'), + sr_created = _('your subreddit has been created'), more_info_link = _("visit [%(link)s](%(link)s) for more information"), sr_messages = dict( - empty = _('you have not subscribed to any reddits.'), - subscriber = _('below are the reddits you have subscribed to'), - contributor = _('below are the reddits that you are an approved submitter on.'), - moderator = _('below are the reddits that you have moderator access to.') + empty = _('you have not subscribed to any subreddits.'), + subscriber = _('below are the subreddits you have subscribed to'), + contributor = _('below are the subreddits that you are an approved submitter on.'), + moderator = _('below are the subreddits that you have moderator access to.') ), - sr_subscribe = _('click the `subscribe` or `unsubscribe` buttons to choose which reddits appear on your front page.'), + sr_subscribe = _('click the `subscribe` or `unsubscribe` buttons to choose which subreddits appear on your front page.'), - searching_a_reddit = _('you\'re searching within the [%(reddit_name)s](%(reddit_link)s) reddit. '+ - 'you can also search within [all reddits](%(all_reddits_link)s)'), + searching_a_reddit = _('you\'re searching within the [%(reddit_name)s](%(reddit_link)s) subreddit. '+ + 'you can also search within [all subreddits](%(all_reddits_link)s)'), css_validator_messages = dict( broken_url = _('"%(brokenurl)s" is not a valid URL'), diff --git a/r2/r2/lib/utils/utils.py b/r2/r2/lib/utils/utils.py index cdb3d8c7f..750f54b6d 100644 --- a/r2/r2/lib/utils/utils.py +++ b/r2/r2/lib/utils/utils.py @@ -521,17 +521,16 @@ class UrlParser(object): def path_has_subreddit(self): """ utility method for checking if the path starts with a - subreddit specifier (namely /r/ or /reddits/). + subreddit specifier (namely /r/ or /subreddits/). """ - return (self.path.startswith('/r/') or - self.path.startswith('/reddits/')) + return self.path.startswith(('/r/', '/subreddits/', '/reddits/')) def get_subreddit(self): """checks if the current url refers to a subreddit and returns that subreddit object. The cases here are: * the hostname is unset or is g.domain, in which case it - looks for /r/XXXX or /reddits. The default in this case + looks for /r/XXXX or /subreddits. The default in this case is Default. * the hostname is a cname to a known subreddit. @@ -543,7 +542,7 @@ class UrlParser(object): if not self.hostname or self.hostname.startswith(g.domain): if self.path.startswith('/r/'): return Subreddit._by_name(self.path.split('/')[2]) - elif self.path.startswith('/reddits/'): + elif self.path.startswith(('/subreddits/', '/reddits/')): return Sub else: return DefaultSR() diff --git a/r2/r2/lib/validator/validator.py b/r2/r2/lib/validator/validator.py index ef7dcc108..fda5524de 100644 --- a/r2/r2/lib/validator/validator.py +++ b/r2/r2/lib/validator/validator.py @@ -1257,7 +1257,7 @@ class VMessageRecipient(VExistingUname): if isinstance(s, FakeSubreddit): raise NotFound, "fake subreddit" if s._spam: - raise NotFound, "banned community" + raise NotFound, "banned subreddit" return s except NotFound: self.set_error(errors.SUBREDDIT_NOEXIST) diff --git a/r2/r2/models/subreddit.py b/r2/r2/models/subreddit.py index fad624344..084a24a74 100644 --- a/r2/r2/models/subreddit.py +++ b/r2/r2/models/subreddit.py @@ -87,7 +87,7 @@ class Subreddit(Thing, Printable): over_18 = False, exclude_banned_modqueue = False, mod_actions = 0, - sponsorship_text = "this reddit is sponsored by", + sponsorship_text = "this subreddit is sponsored by", sponsorship_url = None, sponsorship_img = None, sponsorship_name = None, @@ -1282,7 +1282,7 @@ class SubSR(FakeSubreddit): @property def path(self): - return "/reddits/" + return "/subreddits/" class DomainSR(FakeSubreddit): @property diff --git a/r2/r2/templates/createsubreddit.html b/r2/r2/templates/createsubreddit.html index 8e25d535d..1b7f234e6 100644 --- a/r2/r2/templates/createsubreddit.html +++ b/r2/r2/templates/createsubreddit.html @@ -214,7 +214,7 @@ %endif >
- ${_("you must be at least eighteen to view this reddit")} + ${_("you must be at least eighteen to view this subreddit")}
diff --git a/r2/r2/templates/pagenamenav.compact b/r2/r2/templates/pagenamenav.compact
index 45060a0d0..f48e9cfa2 100644
--- a/r2/r2/templates/pagenamenav.compact
+++ b/r2/r2/templates/pagenamenav.compact
@@ -28,9 +28,9 @@
%def>
-<%def name="reddits()">
+<%def name="subreddits()">
- ${plain_link(_("reddits"), "/reddits/", _sr_path=False)}
+ ${plain_link(_("subreddits"), "/subreddits/", _sr_path=False)}
%def>
diff --git a/r2/r2/templates/pagenamenav.html b/r2/r2/templates/pagenamenav.html
index 4ca4663ef..811a3828f 100644
--- a/r2/r2/templates/pagenamenav.html
+++ b/r2/r2/templates/pagenamenav.html
@@ -31,9 +31,9 @@
%def>
-<%def name="reddits()">
+<%def name="subreddits()">
- ${plain_link(_("reddits"), "/reddits/", _sr_path=False)}
+ ${plain_link(_("subreddits"), "/subreddits/", _sr_path=False)}
%def>
diff --git a/r2/r2/templates/pagenamenav.mobile b/r2/r2/templates/pagenamenav.mobile
index facf8d45a..55fd97e6a 100644
--- a/r2/r2/templates/pagenamenav.mobile
+++ b/r2/r2/templates/pagenamenav.mobile
@@ -26,9 +26,9 @@
%def>
-<%def name="reddits()">
+<%def name="subreddits()">
- ${_("reddits")}
+ ${_("subreddits")}
%def>
diff --git a/r2/r2/templates/prefoptions.html b/r2/r2/templates/prefoptions.html
index d3dc83a6f..e84384ec3 100644
--- a/r2/r2/templates/prefoptions.html
+++ b/r2/r2/templates/prefoptions.html
@@ -116,7 +116,7 @@
%if not c.user.pref_compress:
${media_radio("on", _("show thumbnails next to links"))}
${media_radio("off", _("don't show thumbnails next to links"))}
- ${media_radio("subreddit", _("show thumbnails based on that reddit's media preferences"))}
+ ${media_radio("subreddit", _("show thumbnails based on that subreddit's media preferences"))}
${checkbox(_("make safe(r) for work "), "no_profanity", disabled = not c.user.pref_over_18, disabled_text = "(requires over 18)")}
@@ -230,7 +230,7 @@
minimum $30 / day
- + %def>