diff --git a/r2/r2/controllers/api.py b/r2/r2/controllers/api.py index c52899035..ad7c23610 100755 --- a/r2/r2/controllers/api.py +++ b/r2/r2/controllers/api.py @@ -1597,7 +1597,7 @@ class ApiController(RedditController, OAuth2ResourceController): 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 diff --git a/r2/r2/controllers/validator/wiki.py b/r2/r2/controllers/validator/wiki.py index 170d282c1..56e77aed3 100644 --- a/r2/r2/controllers/validator/wiki.py +++ b/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 diff --git a/r2/r2/controllers/wiki.py b/r2/r2/controllers/wiki.py index 94d2fb7b7..d9948704e 100644 --- a/r2/r2/controllers/wiki.py +++ b/r2/r2/controllers/wiki.py @@ -278,7 +278,7 @@ class WikiApiController(WikiController): 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 @@ class WikiApiController(WikiController): 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({}) diff --git a/r2/r2/models/subreddit.py b/r2/r2/models/subreddit.py index b39cf7974..0ba19e98b 100644 --- a/r2/r2/models/subreddit.py +++ b/r2/r2/models/subreddit.py @@ -364,7 +364,7 @@ class Subreddit(Thing, Printable): 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: diff --git a/r2/r2/models/wiki.py b/r2/r2/models/wiki.py index c3c3762dc..51ebd433f 100644 --- a/r2/r2/models/wiki.py +++ b/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 @@ class WikiPage(tdb_cassandra.Thing): 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]