From 3a6c3cc5ca9ea6fbb997246fdf46748491a7f0d4 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Fri, 14 Aug 2015 09:51:52 -0700 Subject: [PATCH] Fix new Question in Ponder Summary: I derped here and broke new questions, also remove old Answer constants Test Plan: Ask a new question, see it save Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D13899 --- .../ponder/constants/PonderQuestionStatus.php | 19 ------------ .../PonderQuestionEditController.php | 8 +++-- .../PonderQuestionViewController.php | 31 ++++++++++--------- 3 files changed, 22 insertions(+), 36 deletions(-) diff --git a/src/applications/ponder/constants/PonderQuestionStatus.php b/src/applications/ponder/constants/PonderQuestionStatus.php index 917539f81b..61a446353e 100644 --- a/src/applications/ponder/constants/PonderQuestionStatus.php +++ b/src/applications/ponder/constants/PonderQuestionStatus.php @@ -7,9 +7,6 @@ final class PonderQuestionStatus extends PonderConstants { const STATUS_CLOSED_OBSOLETE = 'obsolete'; const STATUS_CLOSED_DUPLICATE = 'duplicate'; - const ANSWER_STATUS_VISIBLE = 'visible'; - const ANSWER_STATUS_HIDDEN = 'hidden'; - public static function getQuestionStatusMap() { return array( self::STATUS_OPEN => pht('Open'), @@ -89,20 +86,4 @@ final class PonderQuestionStatus extends PonderConstants { ); } - public static function getAnswerStatusMap() { - return array( - self::ANSWER_STATUS_VISIBLE => pht('Visible'), - self::ANSWER_STATUS_HIDDEN => pht('Hidden'), - ); - } - - public static function getAnswerStatusName($status) { - $map = array( - self::ANSWER_STATUS_VISIBLE => pht('Visible'), - self::ANSWER_STATUS_HIDDEN => pht('Hidden'), - ); - return idx($map, $status, pht('Unknown')); - } - - } diff --git a/src/applications/ponder/controller/PonderQuestionEditController.php b/src/applications/ponder/controller/PonderQuestionEditController.php index 71b9615cca..41123d6049 100644 --- a/src/applications/ponder/controller/PonderQuestionEditController.php +++ b/src/applications/ponder/controller/PonderQuestionEditController.php @@ -68,9 +68,11 @@ final class PonderQuestionEditController extends PonderController { ->setTransactionType(PonderQuestionTransaction::TYPE_CONTENT) ->setNewValue($v_content); - $xactions[] = id(clone $template) - ->setTransactionType(PonderQuestionTransaction::TYPE_STATUS) - ->setNewValue($v_status); + if (!$is_new) { + $xactions[] = id(clone $template) + ->setTransactionType(PonderQuestionTransaction::TYPE_STATUS) + ->setNewValue($v_status); + } $xactions[] = id(clone $template) ->setTransactionType(PhabricatorTransactions::TYPE_VIEW_POLICY) diff --git a/src/applications/ponder/controller/PonderQuestionViewController.php b/src/applications/ponder/controller/PonderQuestionViewController.php index a1e526648d..06f924510f 100644 --- a/src/applications/ponder/controller/PonderQuestionViewController.php +++ b/src/applications/ponder/controller/PonderQuestionViewController.php @@ -171,23 +171,26 @@ final class PonderQuestionViewController extends PonderController { $view->invokeWillRenderEvent(); - $view->addSectionHeader( + $details = PhabricatorMarkupEngine::renderOneObject( + $question, + $question->getMarkupField(), + $viewer); + + if ($details) { + $view->addSectionHeader( pht('Details'), PHUIPropertyListView::ICON_SUMMARY); - $view->addTextContent( - array( - phutil_tag( - 'div', - array( - 'class' => 'phabricator-remarkup', - ), - PhabricatorMarkupEngine::renderOneObject( - $question, - $question->getMarkupField(), - $viewer)), - )); - + $view->addTextContent( + array( + phutil_tag( + 'div', + array( + 'class' => 'phabricator-remarkup', + ), + $details), + )); + } return $view; }