From 7850a4b25a6280975a20b9fd5cfee39aabef2b8f Mon Sep 17 00:00:00 2001 From: Andre D Date: Thu, 6 Dec 2012 11:46:56 -0500 Subject: [PATCH] wiki: Fix deleted account leak. --- r2/r2/lib/jsontemplates.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/r2/r2/lib/jsontemplates.py b/r2/r2/lib/jsontemplates.py index cdb0a1690..bf1aa84e0 100755 --- a/r2/r2/lib/jsontemplates.py +++ b/r2/r2/lib/jsontemplates.py @@ -600,7 +600,9 @@ class WikiViewJsonTemplate(ThingJsonTemplate): def data(self, thing): edit_date = time.mktime(thing.edit_date.timetuple()) if thing.edit_date else None - edit_by = Wrapped(thing.edit_by).render() if thing.edit_by else None + edit_by = None + if thing.edit_by and not thing.edit_by._deleted: + edit_by = Wrapped(thing.edit_by).render() return dict(content_md=thing.page_content_md, content_html=wikimarkdown(thing.page_content_md), revision_by=edit_by, @@ -620,7 +622,10 @@ class WikiRevisionJsonTemplate(ThingJsonTemplate): def render(self, thing, *a, **kw): timestamp = time.mktime(thing.date.timetuple()) if thing.date else None author = thing.get_author() - author = Wrapped(author).render() if author else None + if author and not author._deleted: + author = Wrapped(author).render() + else: + author = None return ObjectTemplate(dict(author=author, id=str(thing._id), timestamp=timestamp,