POST_compose: use validator's 'required' parameter

We're just ignoring the error that gets set, so we might as well have it not
set that error in the first place if we don't care about it.
This commit is contained in:
xiongchiamiov
2015-11-17 12:43:12 -08:00
parent 88512d64f8
commit 07dc394cdd

View File

@@ -328,7 +328,7 @@ class ApiController(RedditController):
VCaptcha(),
VUser(),
VModhash(),
from_sr=VSRByName('from_sr'),
from_sr=VSRByName('from_sr', required=False),
to=VMessageRecipient('to'),
subject=VLength('subject', 100, empty_error=errors.NO_SUBJECT),
body=VMarkdownLength(['text', 'message'], max_length=10000),
@@ -369,8 +369,6 @@ class ApiController(RedditController):
if from_sr and from_sr._spam:
return
c.errors.remove((errors.BAD_SR_NAME, "from_sr"))
if from_sr:
if not from_sr.is_moderator_with_perms(c.user, "mail"):
abort(403)