Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Added Error value for Bad CSS on API #519

Closed
wants to merge 1 commit into
from
Jump to file or symbol
Failed to load files and symbols.
+6 −0
Split
View
@@ -1217,6 +1217,8 @@ def POST_subreddit_stylesheet(self, form, jquery,
form.set_html(".status", _('validation errors'))
form.set_html(".errors ul", ''.join(error_items))
form.find('.errors').show()
+ c.errors.add(errors.BAD_CSS, field = "stylesheet_contents")
+ form.has_errors("stylesheet_contents", errors.BAD_CSS)
return
else:
form.find('.errors').hide()
@@ -1239,6 +1241,8 @@ def POST_subreddit_stylesheet(self, form, jquery,
except ConflictException as e:
form.set_html(".status", _('conflict error'))
form.set_html(".errors ul", _('There was a conflict while editing the stylesheet'))
+ c.errors.add(errors.CSS_CONFLICT, field = "stylesheet_contents")
+ form.has_errors("stylesheet_contents", errors.CSS_CONFLICT)
form.find('#conflict_box').show()
form.set_inputs(conflict_old=e.your,
prevstyle=e.new_id, stylesheet_contents=e.new)
@@ -92,6 +92,8 @@
('NO_LINKS', _("that reddit only allows text posts")),
('TOO_OLD', _("that's a piece of history now; it's too late to reply to it")),
('BAD_CSS_NAME', _('invalid css name')),
+ ('BAD_CSS',_('invalid css')),
+ ('CSS_CONFLICT',_('css been edited since pageload')),
('TOO_MUCH_FLAIR_CSS', _('too many flair css classes')),
('BAD_FLAIR_TARGET', _('not a valid flair target')),
('OAUTH2_INVALID_CLIENT', _('invalid client id')),