diff --git a/r2/r2/controllers/api.py b/r2/r2/controllers/api.py index 7557dccff..9f52475d3 100755 --- a/r2/r2/controllers/api.py +++ b/r2/r2/controllers/api.py @@ -1368,6 +1368,7 @@ class ApiController(RedditController): title = VLength("title", max_length = 100), header_title = VLength("header-title", max_length = 500), domain = VCnameDomain("domain"), + public_description = VMarkdown("public_description", max_length = 500), description = VMarkdown("description", max_length = 5120), lang = VLang("lang"), over_18 = VBoolean('over_18'), @@ -1393,7 +1394,7 @@ class ApiController(RedditController): if k in ('name', 'title', 'domain', 'description', 'over_18', 'show_media', 'show_cname_sidebar', 'type', 'link_type', 'lang', "css_on_cname", "header_title", - 'allow_top')) + 'allow_top', 'public_description')) #if a user is banned, return rate-limit errors if c.user._spam: @@ -1419,6 +1420,7 @@ class ApiController(RedditController): elif form.has_errors('domain', errors.BAD_CNAME, errors.USED_CNAME): form.find('#example_domain').hide() elif (form.has_errors(('type', 'link_type'), errors.INVALID_OPTION) or + form.has_errors('public_description', errors.TOO_LONG) or form.has_errors('description', errors.TOO_LONG)): pass diff --git a/r2/r2/lib/jsontemplates.py b/r2/r2/lib/jsontemplates.py index 808d5cc41..4b75396c4 100755 --- a/r2/r2/lib/jsontemplates.py +++ b/r2/r2/lib/jsontemplates.py @@ -212,6 +212,7 @@ class SubredditJsonTemplate(ThingJsonTemplate): url = "path", over18 = "over_18", description = "description", + public_description = "public_description", display_name = "name", header_img = "header", header_size = "header_size", diff --git a/r2/r2/models/modaction.py b/r2/r2/models/modaction.py index 06b357da6..4410338a1 100644 --- a/r2/r2/models/modaction.py +++ b/r2/r2/models/modaction.py @@ -69,7 +69,8 @@ class ModAction(tdb_cassandra.UuidThing, Printable): 'remove_self': _('removed self'), # editsettings 'title': _('title'), - 'description': _('description'), + 'public_description': _('description'), + 'description': _('sidebar'), 'lang': _('language'), 'type': _('type'), 'link_type': _('link type'), diff --git a/r2/r2/models/subreddit.py b/r2/r2/models/subreddit.py index 7b07c8f1e..be3d57af5 100644 --- a/r2/r2/models/subreddit.py +++ b/r2/r2/models/subreddit.py @@ -57,6 +57,7 @@ class Subreddit(Thing, Printable): header_size = None, header_title = "", allow_top = False, # overridden in "_new" + public_description = '', description = '', images = {}, reported = 0, @@ -388,7 +389,11 @@ class Subreddit(Thing, Printable): #will seem less horrible when add_props is in pages.py from r2.lib.pages import UserText - item.usertext = UserText(item, item.description, target=target) + item.description_usertext = UserText(item, item.description, target=target) + if item.public_description or item.description: + item.public_description_usertext = UserText(item, item.public_description or item.description, target=target) + else: + item.public_description_usertext = None Printable.add_props(user, wrapped) diff --git a/r2/r2/templates/createsubreddit.html b/r2/r2/templates/createsubreddit.html index 3f89e1d86..a82ee6820 100644 --- a/r2/r2/templates/createsubreddit.html +++ b/r2/r2/templates/createsubreddit.html @@ -66,7 +66,16 @@ %utils:line_field> <%utils:line_field title="${_('description')}" css_class="usertext" - description="${_('500 characters max. Make them count.')}"> + description="${_('publicly describe your subreddit for all to see. 500 characters max.')}"> + %if thing.site and thing.site.public_description: + ${UserText(None, text=thing.site.public_description or "", editable=True, creating=True, name="public_description", have_form=False)} + %else: + ${UserText(None, text="", creating=True, name="public_description", have_form=False)} + %endif + %utils:line_field> + + <%utils:line_field title="${_('sidebar')}" css_class="usertext" + description="${_('shown in the sidebar of your subreddit. 5120 characters max.')}"> %if thing.site and thing.site.description: ${UserText(None, text = thing.site.description or "", editable = True, creating = True, name="description", have_form = False)} %else: diff --git a/r2/r2/templates/subreddit.compact b/r2/r2/templates/subreddit.compact index 10f3e6b6a..5b70cbab1 100644 --- a/r2/r2/templates/subreddit.compact +++ b/r2/r2/templates/subreddit.compact @@ -43,7 +43,7 @@ reverse = thing.subscriber)}
${tagline()}
- %if thing.description: + %if thing.public_description_usertext: %endif diff --git a/r2/r2/templates/subreddit.html b/r2/r2/templates/subreddit.html index ee0ecbf3d..b4a3e2dc3 100644 --- a/r2/r2/templates/subreddit.html +++ b/r2/r2/templates/subreddit.html @@ -42,9 +42,9 @@ ${self.admintagline()} %endif -%if thing.description: +%if thing.public_description_usertext:
diff --git a/r2/r2/templates/subreddit.xml b/r2/r2/templates/subreddit.xml
index fa7578d4d..26df978d8 100644
--- a/r2/r2/templates/subreddit.xml
+++ b/r2/r2/templates/subreddit.xml
@@ -26,8 +26,8 @@