1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 00:42:41 +01:00

Disallow contentless ponder questions

Test Plan:
* submitted various comments (empty, whitespace, real) and
verified response

Reviewers: pieter, epriestley

CC: vrana, aran, Korvin

Maniphest Tasks: T1644

Differential Revision: https://secure.phabricator.com/D3505
This commit is contained in:
zacharyg 2012-09-17 13:52:43 -07:00
parent e2ae82d455
commit 76d78acfae
2 changed files with 12 additions and 2 deletions

View file

@ -40,6 +40,16 @@ final class PonderCommentSaveController extends PonderController {
}
$content = $request->getStr('content');
if (!strlen(trim($content))) {
$dialog = new AphrontDialogView();
$dialog->setUser($request->getUser());
$dialog->setTitle('Empty comment');
$dialog->appendChild('<p>Your comment must not be empty.</p>');
$dialog->addCancelButton('/Q'.$question_id);
return id(new AphrontDialogResponse())->setDialog($dialog);
}
$res = new PonderComment();
$res
->setContent($content)
@ -51,8 +61,7 @@ final class PonderCommentSaveController extends PonderController {
return id(new AphrontRedirectResponse())
->setURI(
id(new PhutilURI('/Q'. $question->getID()))
->setFragment('comment-' . $res->getID()));
id(new PhutilURI('/Q'. $question->getID())));
}
}

View file

@ -55,6 +55,7 @@ final class PonderAddCommentView extends AphrontView {
$form
->setUser($this->user)
->setAction($this->actionURI)
->setWorkflow(true)
->addHiddenInput('target', $target)
->addHiddenInput('question_id', $questionID)
->appendChild(