SubredditRules: Send rendered markdown in api responses.

In the create and update endpoints, send the rendered description
markdown in the response. We don’t have client-side markdown rendering,
so this is necessary for the rules page to be fully ajax-y.
This commit is contained in:
Matt Lee
2015-11-18 14:06:38 -08:00
committed by MelissaCole
parent b2f6347741
commit 13e47c5a3f

View File

@@ -5045,6 +5045,11 @@ class ApiController(RedditController):
SubredditRules.create(c.site, short_name, description)
ModAction.create(c.site, c.user, 'createrule', details=short_name)
if description:
description_html = safemarkdown(description, wrap=False)
form._send_data(description_html=description_html)
form.refresh()
@require_oauth2_scope("modconfig")
@@ -5072,6 +5077,11 @@ class ApiController(RedditController):
SubredditRules.update(c.site, old_short_name, short_name,
description)
ModAction.create(c.site, c.user, 'editrule', details=short_name)
if description:
description_html = safemarkdown(description, wrap=False)
form._send_data(description_html=description_html)
form.refresh()
@require_oauth2_scope("modconfig")