Add commenting to Badges

Summary: Fixes T8949. Adds the ability to render honors on those who have fought and received badges of distinction and honor.

Test Plan: Write 'asdf'. See 'asdf'.

Reviewers: btrahan, epriestley

Reviewed By: epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T8949

Differential Revision: https://secure.phabricator.com/D13704
This commit is contained in:
Chad Little
2015-07-24 10:56:08 -07:00
parent 7f2d27fed3
commit 10fb011a49
8 changed files with 123 additions and 3 deletions

View File

@@ -52,8 +52,6 @@ final class PhabricatorBadgesViewController
$timeline = $this->buildTransactionTimeline(
$badge,
new PhabricatorBadgesTransactionQuery());
$timeline
->setShouldTerminate(true);
$recipient_phids = $badge->getRecipientPHIDs();
$recipient_phids = array_reverse($recipient_phids);
@@ -64,12 +62,15 @@ final class PhabricatorBadgesViewController
->setHandles($handles)
->setUser($viewer);
$add_comment = $this->buildCommentForm($badge);
return $this->buildApplicationPage(
array(
$crumbs,
$box,
$recipient_list,
$timeline,
$add_comment,
),
array(
'title' => $title,
@@ -154,4 +155,24 @@ final class PhabricatorBadgesViewController
return $view;
}
private function buildCommentForm(PhabricatorBadgesBadge $badge) {
$viewer = $this->getViewer();
$is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business');
$add_comment_header = $is_serious
? pht('Add Comment')
: pht('Render Honors');
$draft = PhabricatorDraft::newFromUserAndKey($viewer, $badge->getPHID());
return id(new PhabricatorApplicationTransactionCommentView())
->setUser($viewer)
->setObjectPHID($badge->getPHID())
->setDraft($draft)
->setHeaderText($add_comment_header)
->setAction($this->getApplicationURI('/comment/'.$badge->getID().'/'))
->setSubmitButtonName(pht('Add Comment'));
}
}