The string formatting inside of the 'subreddit_report_form' template function is causing
the underscore template tag to get escaped, so the link doesn't render properly on the
frontend. Moving the call to 'unsafe' fixes it, and should be safe since 'sr_name' will only ever be the name of a subreddit or the underscore template tag.
Adds methods to the model and collections to generate JSON compatible
with rendering the rules, and updates (or creates) the rules stored in
sessionStorage on page load and on any change.
The initial rendering of the rules is done in mako, but all subsequent
rendering of the rules is done client-side. Using the wrong template
tags here creates an unnecessary vulnerability that could be used to
XSS attack a limited set of users (mods could potentially XSS attack
other mods of the same sub).
Items in LESS_STYLESHEETS do not automatically rebuild when imported files
change. Items in SPRITED_STYLESHEETS automatically build when any other less
file updates, so that works for now. Stylesheets run through the spriter
will throw an error if they don't actually contain any sprites, so I added a
dummy sprite rule to modtools.less.
Adds a new js module and css file for mod tools, and a new page that
includes them. This is so that, moving forward, we don’t have to cram
everything into the reddit.js package.
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.
A js module for handling api errors and client-side validation errors.
Right now, most of this is done through the jQuery-json response and
through custom code on a per-feature basis. This module provides a way
to consume API errors that would normally be displayed through the
jQuery-json response handler, as well as a way to define errors on the
client side that display in the same way.
Adds the following errors:
SR_RULE_EXISTS if trying to create a new rule with a short_name that
already exists.
SR_RULE_DOESNT_EXIST if trying to update a rule with a short_name that
does not exist.
SR_RULE_TOO_MANY if trying to create a new rule when the subreddit
already has the max number of rules.