Remove all "FileHasObject" edge reads and writes
[phabricator.git] / src / applications / badges / controller / PhabricatorBadgesRecipientsController.php
bloba28a37ac3013f88231dcda1792e31abf55e637bf
1 <?php
3 final class PhabricatorBadgesRecipientsController
4 extends PhabricatorBadgesProfileController {
6 public function shouldAllowPublic() {
7 return true;
10 public function handleRequest(AphrontRequest $request) {
11 $viewer = $request->getViewer();
12 $id = $request->getURIData('id');
14 $badge = id(new PhabricatorBadgesQuery())
15 ->setViewer($viewer)
16 ->withIDs(array($id))
17 ->executeOne();
18 if (!$badge) {
19 return new Aphront404Response();
21 $this->setBadge($badge);
23 $awards = id(new PhabricatorBadgesAwardQuery())
24 ->setViewer($viewer)
25 ->withBadgePHIDs(array($badge->getPHID()))
26 ->execute();
28 $recipient_phids = mpull($awards, 'getRecipientPHID');
29 $recipient_phids = array_reverse($recipient_phids);
30 $handles = $this->loadViewerHandles($recipient_phids);
32 $crumbs = $this->buildApplicationCrumbs();
33 $crumbs->addTextCrumb(pht('Recipients'));
34 $crumbs->setBorder(true);
35 $title = $badge->getName();
37 $header = $this->buildHeaderView();
39 $recipient_list = id(new PhabricatorBadgesRecipientsListView())
40 ->setBadge($badge)
41 ->setAwards($awards)
42 ->setHandles($handles)
43 ->setUser($viewer);
45 $view = id(new PHUITwoColumnView())
46 ->setHeader($header)
47 ->setFooter(array(
48 $recipient_list,
49 ));
51 $navigation = $this->buildSideNavView('recipients');
53 return $this->newPage()
54 ->setTitle($title)
55 ->setCrumbs($crumbs)
56 ->setPageObjectPHIDs(array($badge->getPHID()))
57 ->setNavigation($navigation)
58 ->appendChild($view);