mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-04-05 03:00:15 -04:00
wiki: Use WrappedUser for wiki page settings.
This commit is contained in:
@@ -193,7 +193,7 @@ class WikiController(RedditController):
|
||||
@wiki_validate(page=VWikiPage('page', restricted=True, modonly=True))
|
||||
def GET_wiki_settings(self, page):
|
||||
settings = {'permlevel': page._get('permlevel', 0)}
|
||||
mayedit = page.get_editors()
|
||||
mayedit = page.get_editor_accounts()
|
||||
return WikiSettings(settings, mayedit, show_settings=not page.special,
|
||||
page=page.name, may_revise=True).render()
|
||||
|
||||
|
||||
@@ -612,8 +612,9 @@ class WikiSettingsJsonTemplate(ThingJsonTemplate):
|
||||
return "wikipagesettings"
|
||||
|
||||
def data(self, thing):
|
||||
editors = [Wrapped(e).render() for e in thing.mayedit]
|
||||
return dict(permlevel=thing.permlevel,
|
||||
editors=thing.mayedit)
|
||||
editors=editors)
|
||||
|
||||
class WikiRevisionJsonTemplate(ThingJsonTemplate):
|
||||
def render(self, thing, *a, **kw):
|
||||
|
||||
@@ -260,7 +260,14 @@ class WikiPage(tdb_cassandra.Thing):
|
||||
cur_node[pagename] = [page, OrderedDict()]
|
||||
|
||||
return page_tree, pages
|
||||
|
||||
|
||||
def get_editor_accounts(self):
|
||||
editors = self.get_editors()
|
||||
accounts = []
|
||||
for editor in editors:
|
||||
accounts.append(Account._by_name(editor, allow_deleted=True))
|
||||
return accounts
|
||||
|
||||
def get_editors(self, properties=None):
|
||||
try:
|
||||
return WikiPageEditors._byID(self._id, properties=properties)._values().keys() or []
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
<%!
|
||||
from urllib import quote
|
||||
from r2.lib.pages import WrappedUser
|
||||
%>
|
||||
|
||||
<div class="fancy-settings">
|
||||
@@ -62,9 +63,9 @@
|
||||
<ul>
|
||||
%for user in thing.mayedit:
|
||||
<li>
|
||||
${user}
|
||||
${WrappedUser(user)}
|
||||
—
|
||||
${ynbutton(_("delete"), _("done"), quote("..%s/alloweditor/del" % (c.wiki_api_url)), hidden_data=dict(username=user, page=thing.page), post_callback="$.refresh")}
|
||||
${ynbutton(_("delete"), _("done"), quote("..%s/alloweditor/del" % (c.wiki_api_url)), hidden_data=dict(username=user.name, page=thing.page), post_callback="$.refresh")}
|
||||
</li>
|
||||
%endfor
|
||||
</ul>
|
||||
|
||||
Reference in New Issue
Block a user