mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-20 04:20:55 +01:00
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:
parent
4c77ff68aa
commit
96e7f766ff
1 changed files with 17 additions and 2 deletions
|
@ -20,7 +20,7 @@ final class PonderQuestionViewController extends PonderController {
|
|||
return new Aphront404Response();
|
||||
}
|
||||
|
||||
$answers = $this->buildAnswers($question->getAnswers());
|
||||
$answers = $this->buildAnswers($question);
|
||||
|
||||
$answer_add_panel = id(new PonderAddAnswerView())
|
||||
->setQuestion($question)
|
||||
|
@ -81,6 +81,20 @@ final class PonderQuestionViewController extends PonderController {
|
|||
->addPropertyList($properties)
|
||||
->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->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
|
||||
* standard fashion. This is necessary to scale this application.
|
||||
*/
|
||||
private function buildAnswers(array $answers) {
|
||||
private function buildAnswers(PonderQuestion $question) {
|
||||
$viewer = $this->getViewer();
|
||||
$answers = $question->getAnswers();
|
||||
|
||||
$author_phids = mpull($answers, 'getAuthorPHID');
|
||||
$handles = $this->loadViewerHandles($author_phids);
|
||||
|
|
Loading…
Reference in a new issue