diff --git a/r2/r2/controllers/api.py b/r2/r2/controllers/api.py index 66ac5e04e..cc664c292 100644 --- a/r2/r2/controllers/api.py +++ b/r2/r2/controllers/api.py @@ -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, diff --git a/r2/r2/templates/createsubreddit.html b/r2/r2/templates/createsubreddit.html index 0e2364968..11ef72f50 100644 --- a/r2/r2/templates/createsubreddit.html +++ b/r2/r2/templates/createsubreddit.html @@ -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