Correct a parameter order swap in "diffusion.historyquery" for Mercurial
[phabricator.git] / src / applications / people / controller / PhabricatorPeopleProfileRevisionsController.php
blob0c7b6f6a1f8e894e7b5ba537cc329459f23c846f
1 <?php
3 final class PhabricatorPeopleProfileRevisionsController
4 extends PhabricatorPeopleProfileController {
6 public function handleRequest(AphrontRequest $request) {
7 $viewer = $this->getViewer();
8 $id = $request->getURIData('id');
10 $user = id(new PhabricatorPeopleQuery())
11 ->setViewer($viewer)
12 ->withIDs(array($id))
13 ->needProfile(true)
14 ->needProfileImage(true)
15 ->needAvailability(true)
16 ->executeOne();
17 if (!$user) {
18 return new Aphront404Response();
21 $class = 'PhabricatorDifferentialApplication';
22 if (!PhabricatorApplication::isClassInstalledForViewer($class, $viewer)) {
23 return new Aphront404Response();
26 $this->setUser($user);
27 $title = array(pht('Recent Revisions'), $user->getUsername());
28 $header = $this->buildProfileHeader();
29 $commits = $this->buildRevisionsView($user);
31 $crumbs = $this->buildApplicationCrumbs();
32 $crumbs->addTextCrumb(pht('Recent Revisions'));
33 $crumbs->setBorder(true);
35 $nav = $this->newNavigation(
36 $user,
37 PhabricatorPeopleProfileMenuEngine::ITEM_REVISIONS);
39 $view = id(new PHUITwoColumnView())
40 ->setHeader($header)
41 ->addClass('project-view-home')
42 ->addClass('project-view-people-home')
43 ->setFooter(array(
44 $commits,
45 ));
47 return $this->newPage()
48 ->setTitle($title)
49 ->setCrumbs($crumbs)
50 ->setNavigation($nav)
51 ->appendChild($view);
54 private function buildRevisionsView(PhabricatorUser $user) {
55 $viewer = $this->getViewer();
57 $revisions = id(new DifferentialRevisionQuery())
58 ->setViewer($viewer)
59 ->withAuthors(array($user->getPHID()))
60 ->needFlags(true)
61 ->needDrafts(true)
62 ->needReviewers(true)
63 ->setLimit(100)
64 ->execute();
66 $list = id(new DifferentialRevisionListView())
67 ->setViewer($viewer)
68 ->setNoBox(true)
69 ->setRevisions($revisions)
70 ->setNoDataString(pht('No recent revisions.'));
72 $view = id(new PHUIObjectBoxView())
73 ->setHeaderText(pht('Recent Revisions'))
74 ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
75 ->appendChild($list);
77 return $view;