Expose 'archived' subreddit type to admins in the settings UI.

This commit is contained in:
Max Goodman
2012-01-02 12:19:31 -08:00
committed by Neil Williams
parent fb79a8cbe5
commit 7c90a6ea51
2 changed files with 12 additions and 1 deletions

View File

@@ -1264,7 +1264,7 @@ class ApiController(RedditController):
allow_top = VBoolean('allow_top'),
show_media = VBoolean('show_media'),
show_cname_sidebar = VBoolean('show_cname_sidebar'),
type = VOneOf('type', ('public', 'private', 'restricted')),
type = VOneOf('type', ('public', 'private', 'restricted', 'archived')),
link_type = VOneOf('link_type', ('any', 'link', 'self')),
ip = ValidIP(),
sponsor_text =VLength('sponsorship-text', max_length = 500),
@@ -1294,6 +1294,10 @@ class ApiController(RedditController):
if cname_sr and (not sr or sr != cname_sr):
c.errors.add(errors.USED_CNAME)
can_set_archived = c.user_is_admin or (sr and sr.type == 'archived')
if type == 'archived' and not can_set_archived:
form.set_error('type', errors.INVALID_OPTION)
if not sr and form.has_errors("ratelimit", errors.RATELIMIT):
pass
elif not sr and form.has_errors("name", errors.SUBREDDIT_EXISTS,

View File

@@ -110,6 +110,13 @@
${utils.radio_type('type', "private", _("private"),
_("only approved members can view and submit"),
(thing.site and thing.site.type=='private'))}
<% is_archived = thing.site and thing.site.type == 'archived' %>
%if c.user_is_admin or is_archived:
${utils.radio_type('type', "archived", _("archived"),
_("anyone can view, but submissions are no longer accepted"),
is_archived)}
%endif
</table>
</div>
</%utils:line_field>