Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/people/controller/PhabricatorPeopleProfileCommitsController.php
12256 views
1
<?php
2
3
final class PhabricatorPeopleProfileCommitsController
4
extends PhabricatorPeopleProfileController {
5
6
public function handleRequest(AphrontRequest $request) {
7
$viewer = $this->getViewer();
8
$id = $request->getURIData('id');
9
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();
19
}
20
21
$class = 'PhabricatorDiffusionApplication';
22
if (!PhabricatorApplication::isClassInstalledForViewer($class, $viewer)) {
23
return new Aphront404Response();
24
}
25
26
$this->setUser($user);
27
$title = array(pht('Recent Commits'), $user->getUsername());
28
$header = $this->buildProfileHeader();
29
$commits = $this->buildCommitsView($user);
30
31
$crumbs = $this->buildApplicationCrumbs();
32
$crumbs->addTextCrumb(pht('Recent Commits'));
33
$crumbs->setBorder(true);
34
35
$nav = $this->newNavigation(
36
$user,
37
PhabricatorPeopleProfileMenuEngine::ITEM_COMMITS);
38
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
));
46
47
return $this->newPage()
48
->setTitle($title)
49
->setCrumbs($crumbs)
50
->setNavigation($nav)
51
->appendChild($view);
52
}
53
54
private function buildCommitsView(PhabricatorUser $user) {
55
$viewer = $this->getViewer();
56
57
$commits = id(new DiffusionCommitQuery())
58
->setViewer($viewer)
59
->withAuthorPHIDs(array($user->getPHID()))
60
->needCommitData(true)
61
->needIdentities(true)
62
->setLimit(100)
63
->execute();
64
65
$list = id(new DiffusionCommitGraphView())
66
->setViewer($viewer)
67
->setCommits($commits);
68
69
return $list;
70
}
71
}
72
73