Nudge users to close their question if it's been answered
Summary: Adds a notice reminding viewers of their own question to resolve it and mark the correct answer.
Test Plan:
View my own open question, see notice. Resolve question, notice goes away.
{F743481}
Reviewers: epriestley
Reviewed By: epriestley
Subscribers: Korvin
Differential Revision: https://secure.phabricator.com/D13958
This commit is contained in:
@@ -20,7 +20,7 @@ final class PonderQuestionViewController extends PonderController {
|
|||||||
return new Aphront404Response();
|
return new Aphront404Response();
|
||||||
}
|
}
|
||||||
|
|
||||||
$answers = $this->buildAnswers($question->getAnswers());
|
$answers = $this->buildAnswers($question);
|
||||||
|
|
||||||
$answer_add_panel = id(new PonderAddAnswerView())
|
$answer_add_panel = id(new PonderAddAnswerView())
|
||||||
->setQuestion($question)
|
->setQuestion($question)
|
||||||
@@ -81,6 +81,20 @@ final class PonderQuestionViewController extends PonderController {
|
|||||||
->addPropertyList($properties)
|
->addPropertyList($properties)
|
||||||
->appendChild($footer);
|
->appendChild($footer);
|
||||||
|
|
||||||
|
if ($viewer->getPHID() == $question->getAuthorPHID()) {
|
||||||
|
$status = $question->getStatus();
|
||||||
|
$answers_list = $question->getAnswers();
|
||||||
|
if ($answers_list && ($status == PonderQuestionStatus::STATUS_OPEN)) {
|
||||||
|
$info_view = id(new PHUIInfoView())
|
||||||
|
->setSeverity(PHUIInfoView::SEVERITY_WARNING)
|
||||||
|
->appendChild(
|
||||||
|
pht(
|
||||||
|
'If this question has been resolved, please consider closing
|
||||||
|
the question and marking the answer as helpful.'));
|
||||||
|
$object_box->setInfoView($info_view);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$crumbs = $this->buildApplicationCrumbs($this->buildSideNavView());
|
$crumbs = $this->buildApplicationCrumbs($this->buildSideNavView());
|
||||||
$crumbs->addTextCrumb('Q'.$id, '/Q'.$id);
|
$crumbs->addTextCrumb('Q'.$id, '/Q'.$id);
|
||||||
|
|
||||||
@@ -206,8 +220,9 @@ final class PonderQuestionViewController extends PonderController {
|
|||||||
* TODO - re-factor this to ajax in one answer panel at a time in a more
|
* TODO - re-factor this to ajax in one answer panel at a time in a more
|
||||||
* standard fashion. This is necessary to scale this application.
|
* standard fashion. This is necessary to scale this application.
|
||||||
*/
|
*/
|
||||||
private function buildAnswers(array $answers) {
|
private function buildAnswers(PonderQuestion $question) {
|
||||||
$viewer = $this->getViewer();
|
$viewer = $this->getViewer();
|
||||||
|
$answers = $question->getAnswers();
|
||||||
|
|
||||||
$author_phids = mpull($answers, 'getAuthorPHID');
|
$author_phids = mpull($answers, 'getAuthorPHID');
|
||||||
$handles = $this->loadViewerHandles($author_phids);
|
$handles = $this->loadViewerHandles($author_phids);
|
||||||
|
|||||||
Reference in New Issue
Block a user