From a8580cef63aa3ea00dd25f48410ae7abc5f7b4f5 Mon Sep 17 00:00:00 2001 From: Neil Williams Date: Mon, 23 Apr 2012 18:10:18 -0700 Subject: [PATCH] Add useful error page when forbidden from private subreddit. --- r2/r2/controllers/reddit_base.py | 3 +++ r2/r2/lib/strings.py | 2 ++ 2 files changed, 5 insertions(+) diff --git a/r2/r2/controllers/reddit_base.py b/r2/r2/controllers/reddit_base.py index 482de17db..525b920d2 100644 --- a/r2/r2/controllers/reddit_base.py +++ b/r2/r2/controllers/reddit_base.py @@ -878,6 +878,9 @@ class RedditController(MinimalController): # check if the user has access to this subreddit if not c.site.can_view(c.user) and not c.error_page: + errpage = pages.RedditError(strings.private_subreddit_title, + strings.private_subreddit_message) + request.environ['usable_error_content'] = errpage.render() self.abort403() #check over 18 diff --git a/r2/r2/lib/strings.py b/r2/r2/lib/strings.py index 1afddd81c..9dca10223 100644 --- a/r2/r2/lib/strings.py +++ b/r2/r2/lib/strings.py @@ -130,6 +130,8 @@ string_dict = dict( link_info_title = _("%(title)s : %(site)s"), banned_subreddit_title = _("this subreddit has been banned"), banned_subreddit_message = _("most likely this was done automatically by our spam filtering program. the program is still learning, and may even have some bugs, so if you feel the ban was a mistake, please submit a link to our [request a subreddit listing](%(link)s) and be sure to include the **exact name of the subreddit**."), + private_subreddit_title = _("this subreddit is private"), + private_subreddit_message = _("the moderators of this subreddit have set it to private. you must be a moderator or approved submitter to view its contents."), comments_panel_text = _("""The following is a sample of what Reddit users had to say about this page. The full discussion is available [here](%(fd_link)s); you can also get there by clicking the link's title (in the middle of the toolbar, to the right of the comments button)."""), submit_link = _("""You are submitting a link. The key to a successful submission is interesting content and a descriptive title."""),