Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but 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
1  r2/r2/config/templates.py
View
@@ -69,6 +69,7 @@ def api(type, cls):
api('flaircsv', FlairCsvJsonTemplate)
api('subredditstylesheet', StylesheetTemplate)
+api('subredditstylesheetsource', StylesheetTemplate)
api('createsubreddit', SubredditSettingsTemplate)
api('modaction', ModActionTemplate)
4 r2/r2/controllers/error.py
View
@@ -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):
25 r2/r2/controllers/health.py
View
@@ -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())
7 r2/r2/lib/pages/things.py
View
@@ -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.