reddit: Add missing length check on friend and banning note fields.

This commit is contained in:
Andre D
2013-05-20 22:57:52 -07:00
committed by Roger Ostrander
parent 7c3ebceb55
commit 3d447c9d18

View File

@@ -810,6 +810,8 @@ class ApiController(RedditController, OAuth2ResourceController):
friend = VExistingUname('name'),
note = VLength('note', 300))
def POST_friendnote(self, form, jquery, friend, note):
if form.has_errors("note", errors.TOO_LONG):
return
c.user.add_friend_note(friend, note)
form.set_html('.status', _("saved"))
@@ -817,6 +819,8 @@ class ApiController(RedditController, OAuth2ResourceController):
user = VExistingUname('name'),
note = VLength('note', 300))
def POST_relnote(self, form, jquery, type, user, note):
if form.has_errors("note", errors.TOO_LONG):
return
c.site.add_rel_note(type[:-4], user, note)
form.set_html('.status', _("saved"))