Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: reddit/reddit
base: f8256d0b6e213adb0f5d5ea55e90ae75ca444c36
...
head fork: reddit/reddit
compare: 62ed3f8970d500871e10680b18a6c1a7905ca421
  • 5 commits
  • 4 files changed
  • 0 commit comments
  • 2 contributors
View
1  r2/r2/config/templates.py
@@ -69,6 +69,7 @@ def api(type, cls):
api('flaircsv', FlairCsvJsonTemplate)
api('subredditstylesheet', StylesheetTemplate)
+api('subredditstylesheetsource', StylesheetTemplate)
api('createsubreddit', SubredditSettingsTemplate)
api('modaction', ModActionTemplate)
View
4 r2/r2/controllers/error.py
@@ -147,7 +147,9 @@ def send429(self):
return template.render(logo_url=static(g.default_header_url))
def send503(self):
- response.headers["Retry-After"] = str(request.environ["retry_after"])
+ retry_after = request.environ.get("retry_after")
+ if retry_after:
+ response.headers["Retry-After"] = str(retry_after)
return request.environ['usable_error_content']
def GET_document(self):
View
25 r2/r2/controllers/health.py
@@ -20,35 +20,34 @@
# Inc. All Rights Reserved.
###############################################################################
-from threading import Thread
-import os
-import time
import json
+import os
+from pylons import g, request, response
from pylons.controllers.util import abort
-from pylons import c, g, response
-from reddit_base import MinimalController
-from r2.lib.amqp import worker
-from r2.lib.validator import *
+from r2.controllers.reddit_base import MinimalController
from r2.lib import promote
class HealthController(MinimalController):
- def post(self):
- pass
-
def try_pagecache(self):
pass
def pre(self):
pass
+ def post(self):
+ pass
+
def GET_health(self):
- c.dontcache = True
- response.headers['Content-Type'] = 'text/plain'
+ if os.path.exists("/var/opt/reddit/quiesce"):
+ request.environ["usable_error_content"] = "No thanks, I'm full."
+ abort(503)
+
+ response.content_type = "application/json"
return json.dumps(g.versions, sort_keys=True, indent=4)
def GET_promohealth(self):
- response.headers['Content-Type'] = 'text/plain'
+ response.content_type = "application/json"
return json.dumps(promote.health_check())
View
7 r2/r2/lib/pages/things.py
@@ -181,7 +181,12 @@ class MessageButtons(PrintableButtons):
def __init__(self, thing, delete = False, report = True):
was_comment = getattr(thing, 'was_comment', False)
permalink = thing.permalink
- can_reply = c.user_is_loggedin and getattr(thing, "repliable", True)
+ # don't allow replying to self unless it's modmail
+ valid_recipient = (thing.author_id != c.user._id or
+ thing.sr_id)
+ can_reply = (c.user_is_loggedin and
+ getattr(thing, "repliable", True) and
+ valid_recipient)
PrintableButtons.__init__(self, "messagebuttons", thing,
profilepage = c.profilepage,

No commit comments for this range

Something went wrong with that request. Please try again.