Skip to content
Browse files

wiki: Switch wiki authors to id.

  • Loading branch information...
1 parent 0fbe7f6 commit 35bec6972694a182e83ebfea8762e9146d1ba1ac @andre-d andre-d committed with spladug Nov 11, 2012
View
2 r2/r2/controllers/api.py
@@ -1597,7 +1597,7 @@ def apply_wikid_field(sr, form, pagename, value, prev, field, error):
except tdb_cassandra.NotFound:
wikipage = wiki.WikiPage.create(sr, pagename)
try:
- wr = wikipage.revise(value, previous=prev, author=c.user.name)
+ wr = wikipage.revise(value, previous=prev, author=c.user._id36)
setattr(sr, field, value)
if not wr:
return True
View
2 r2/r2/controllers/validator/wiki.py
@@ -90,7 +90,7 @@ def may_revise(sr, user, page=None):
# Global wiki contribute ban
return False
- if page and page.has_editor(user.name):
+ if page and page.has_editor(user._id36):
# If the user is an editor on the page, they may edit
return True
View
6 r2/r2/controllers/wiki.py
@@ -278,7 +278,7 @@ def POST_wiki_edit(self, pageandprevious, content, page_name, reason):
c.site.change_css(content, parsed, previous, reason=reason)
else:
try:
- page.revise(content, previous, c.user.name, reason=reason)
+ page.revise(content, previous, c.user._id36, reason=reason)
except ContentLengthError as e:
self.handle_error(403, 'CONTENT_LENGTH_ERROR', max_length = e.max_length)
@@ -306,9 +306,9 @@ def POST_wiki_allow_editor(self, act, page, user):
if not user:
self.handle_error(404, 'UNKNOWN_USER')
elif act == 'del':
- page.remove_editor(user.name)
+ page.remove_editor(user._id36)
elif act == 'add':
- page.add_editor(user.name)
+ page.add_editor(user._id36)
else:
self.handle_error(400, 'INVALID_ACTION')
return json.dumps({})
View
2 r2/r2/models/subreddit.py
@@ -364,7 +364,7 @@ def parse_css(self, content, verify=True):
def change_css(self, content, parsed, prev=None, reason=None, author=None, force=False):
from r2.models import ModAction
- author = author if author else c.user.name
+ author = author if author else c.user._id36
if content is None:
content = ''
try:
View
6 r2/r2/models/wiki.py
@@ -86,7 +86,7 @@ class WikiRevision(tdb_cassandra.UuidThing, Printable):
def get_author(self):
author = self._get('author')
- return Account._by_name(author, allow_deleted=True) if author else None
+ return Account._byID36(author) if author else None
@classmethod
def add_props(cls, user, wrapped):
@@ -173,7 +173,7 @@ class WikiPage(tdb_cassandra.Thing):
def get_author(self):
if self._get('last_edit_by'):
- return Account._by_name(self.last_edit_by, allow_deleted=True)
+ return Account._byID36(self.last_edit_by)
return None
@classmethod
@@ -271,7 +271,7 @@ def get_listing(cls, sr, filter_check=None):
def get_editor_accounts(self):
editors = self.get_editors()
- accounts = [Account._by_name(editor, allow_deleted=True)
+ accounts = [Account._byID36(editor)
for editor in self.get_editors()]
accounts = [account for account in accounts
if not account._deleted]

0 comments on commit 35bec69

Please sign in to comment.
Something went wrong with that request. Please try again.