diff --git a/r2/r2/controllers/api.py b/r2/r2/controllers/api.py index 44a86f37a..d684fc1f4 100755 --- a/r2/r2/controllers/api.py +++ b/r2/r2/controllers/api.py @@ -1790,6 +1790,9 @@ class ApiController(RedditController, OAuth2ResourceController): public_traffic = VBoolean('public_traffic'), exclude_banned_modqueue = VBoolean('exclude_banned_modqueue'), show_cname_sidebar = VBoolean('show_cname_sidebar'), + spam_links = VOneOf('spam_links', ('low', 'high')), + spam_selfposts = VOneOf('spam_selfposts', ('low', 'high')), + spam_comments = VOneOf('spam_comments', ('low', 'high')), type = VOneOf('type', ('public', 'private', 'restricted', 'gold_restricted', 'archived')), link_type = VOneOf('link_type', ('any', 'link', 'self')), submit_link_label=VLength('submit_link_label', max_length=60), @@ -1829,7 +1832,7 @@ class ApiController(RedditController, OAuth2ResourceController): c.errors.add(errors.BAD_REVISION, field=id_field_name) form.has_errors(id_field_name, errors.BAD_REVISION) return False - + # the status button is outside the form -- have to reset by hand form.parent().set_html('.status', "") @@ -1842,7 +1845,8 @@ class ApiController(RedditController, OAuth2ResourceController): 'submit_link_label', 'comment_score_hide_mins', 'submit_text_label', 'lang', 'css_on_cname', 'header_title', 'over_18', 'wikimode', 'wiki_edit_karma', - 'wiki_edit_age', 'allow_top', 'public_description')) + 'wiki_edit_age', 'allow_top', 'public_description', + 'spam_links', 'spam_selfposts', 'spam_comments')) public_description = kw.pop('public_description') description = kw.pop('description') diff --git a/r2/r2/models/subreddit.py b/r2/r2/models/subreddit.py index 1287c962f..34921f03a 100644 --- a/r2/r2/models/subreddit.py +++ b/r2/r2/models/subreddit.py @@ -223,6 +223,9 @@ class Subreddit(Thing, Printable, BaseSite): allow_comment_gilding=True, hide_subscribers=False, public_traffic=False, + spam_links='high', + spam_selfposts='high', + spam_comments='low', ) _essentials = ('type', 'name', 'lang') _data_int_props = Thing._data_int_props + ('mod_actions', 'reported', diff --git a/r2/r2/templates/createsubreddit.html b/r2/r2/templates/createsubreddit.html index 1c997ceda..998342c12 100644 --- a/r2/r2/templates/createsubreddit.html +++ b/r2/r2/templates/createsubreddit.html @@ -217,6 +217,42 @@ + + <%utils:line_field title="${_('spam filter strength')}" + description='${_("high is the standard filter, low disables most filtering")}'> +
+ + + + + + + + + + + + + +
${_("links")}: + ${utils.inline_radio_type('spam_links', 'low', _("low"), + checked=thing.site and thing.site.spam_links == 'low')} + ${utils.inline_radio_type('spam_links', 'high', _("high"), + checked=thing.site and thing.site.spam_links == 'high')} +
${_("self posts")}: + ${utils.inline_radio_type('spam_selfposts', 'low', _("low"), + checked=thing.site and thing.site.spam_selfposts == 'low')} + ${utils.inline_radio_type('spam_selfposts', 'high', _("high"), + checked=thing.site and thing.site.spam_selfposts == 'high')} +
${_("comments")}: + ${utils.inline_radio_type('spam_comments', 'low', _("low"), + checked=thing.site and thing.site.spam_comments == 'low')} + ${utils.inline_radio_type('spam_comments', 'high', _("high"), + checked=thing.site and thing.site.spam_comments == 'high')} +
+
+ + <%utils:line_field title="${_('other options')}">