From 145bd31bfcfe64297acf3c6758a95a894e534cb5 Mon Sep 17 00:00:00 2001 From: Christopher Slowe Date: Mon, 6 Jul 2009 19:24:29 -0700 Subject: [PATCH] JSON fixes to restore the iPhone app to normal working order --- r2/r2/controllers/front.py | 4 +++- r2/r2/lib/pages/pages.py | 12 ++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/r2/r2/controllers/front.py b/r2/r2/controllers/front.py index 6a62d5ca9..397944c7e 100644 --- a/r2/r2/controllers/front.py +++ b/r2/r2/controllers/front.py @@ -26,6 +26,7 @@ from r2 import config from r2.models import * from r2.lib.pages import * from r2.lib.pages.things import wrap_links +from r2.lib.jsontemplates import is_api from r2.lib.menus import * from r2.lib.utils import to36, sanitize_url, check_cheating, title_to_url from r2.lib.utils import query_string, UrlParser, link_from_url, link_duplicates @@ -179,7 +180,8 @@ class FrontController(RedditController): displayPane.append(PermalinkMessage(article.make_permalink_slow())) # insert reply box only for logged in user - if c.user_is_loggedin and article.subreddit_slow.can_comment(c.user): + if c.user_is_loggedin and article.subreddit_slow.can_comment(c.user)\ + and not is_api(): #no comment box for permalinks displayPane.append(UserText(item = article, creating = True, post_form = 'comment', diff --git a/r2/r2/lib/pages/pages.py b/r2/r2/lib/pages/pages.py index fb3a01cff..2aa8f34f2 100644 --- a/r2/r2/lib/pages/pages.py +++ b/r2/r2/lib/pages/pages.py @@ -116,7 +116,7 @@ class Reddit(Templated): if not c.cname: self.srtopbar = SubredditTopBar() - if c.user_is_loggedin and self.show_sidebar: + if c.user_is_loggedin and self.show_sidebar and not is_api(): self._content = PaneStack([ShareLink(), content]) else: self._content = content @@ -450,9 +450,13 @@ class MessagePage(Reddit): if not kw.has_key('show_sidebar'): kw['show_sidebar'] = False Reddit.__init__(self, *a, **kw) - self.replybox = UserText(item = None, creating = True, - post_form = 'comment', display = False, - cloneable = True) + if is_api(): + self.replybox = None + else: + self.replybox = UserText(item = None, creating = True, + post_form = 'comment', display = False, + cloneable = True) + def content(self): return self.content_stack((self.replybox,