diff --git a/src/applications/ponder/controller/PonderAnswerSaveController.php b/src/applications/ponder/controller/PonderAnswerSaveController.php index 57768cb41a..b015488ffa 100644 --- a/src/applications/ponder/controller/PonderAnswerSaveController.php +++ b/src/applications/ponder/controller/PonderAnswerSaveController.php @@ -34,6 +34,17 @@ final class PonderAnswerSaveController extends PonderController { $answer = $request->getStr('answer'); + // Only want answers with some non whitespace content + if (!strlen(trim($answer))) { + $dialog = new AphrontDialogView(); + $dialog->setUser($request->getUser()); + $dialog->setTitle('Empty answer'); + $dialog->appendChild('
Your answer must not be empty.
'); + $dialog->addCancelButton('/Q'.$question_id); + + return id(new AphrontDialogResponse())->setDialog($dialog); + } + $content_source = PhabricatorContentSource::newForSource( PhabricatorContentSource::SOURCE_WEB, array( @@ -55,8 +66,7 @@ final class PonderAnswerSaveController extends PonderController { PhabricatorSearchPonderIndexer::indexQuestion($question); - return id(new AphrontRedirectResponse()) - ->setURI(id(new PhutilURI('/Q'. $question->getID())) - ->setFragment('A'.$res->getID())); + return id(new AphrontRedirectResponse())->setURI( + id(new PhutilURI('/Q'. $question->getID()))); } } diff --git a/src/applications/ponder/view/PonderAddAnswerView.php b/src/applications/ponder/view/PonderAddAnswerView.php index 512378e3b1..3db0294683 100644 --- a/src/applications/ponder/view/PonderAddAnswerView.php +++ b/src/applications/ponder/view/PonderAddAnswerView.php @@ -53,6 +53,7 @@ final class PonderAddAnswerView extends AphrontView { $form ->setUser($this->user) ->setAction($this->actionURI) + ->setWorkflow(true) ->addHiddenInput('question_id', $question->getID()) ->appendChild( id(new AphrontFormTextAreaControl())