@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3final class HarbormasterLintMessagesController
4 extends HarbormasterController {
5
6 public function shouldAllowPublic() {
7 return true;
8 }
9
10 public function handleRequest(AphrontRequest $request) {
11 $viewer = $this->getViewer();
12
13 $buildable = id(new HarbormasterBuildableQuery())
14 ->setViewer($viewer)
15 ->withIDs(array($request->getURIData('id')))
16 ->needBuilds(true)
17 ->needTargets(true)
18 ->executeOne();
19 if (!$buildable) {
20 return new Aphront404Response();
21 }
22
23 $id = $buildable->getID();
24
25 $target_phids = array();
26 foreach ($buildable->getBuilds() as $build) {
27 foreach ($build->getBuildTargets() as $target) {
28 $target_phids[] = $target->getPHID();
29 }
30 }
31
32 $lint_data = array();
33 if ($target_phids) {
34 $lint_data = id(new HarbormasterBuildLintMessage())->loadAllWhere(
35 'buildTargetPHID IN (%Ls)',
36 $target_phids);
37 } else {
38 $lint_data = array();
39 }
40
41 $lint_table = id(new HarbormasterLintPropertyView())
42 ->setUser($viewer)
43 ->setLintMessages($lint_data);
44
45 $lint = id(new PHUIObjectBoxView())
46 ->setHeaderText(pht('Lint Messages'))
47 ->appendChild($lint_table);
48
49 $crumbs = $this->buildApplicationCrumbs();
50 $this->addBuildableCrumb($crumbs, $buildable);
51 $crumbs->addTextCrumb(pht('Lint'));
52 $crumbs->setBorder(true);
53
54 $title = array(
55 $buildable->getMonogram(),
56 pht('Lint'),
57 );
58
59 $header = id(new PHUIHeaderView())
60 ->setHeader($title);
61
62 $view = id(new PHUITwoColumnView())
63 ->setHeader($header)
64 ->setFooter(array(
65 $lint,
66 ));
67
68 return $this->newPage()
69 ->setTitle($title)
70 ->setCrumbs($crumbs)
71 ->appendChild($view);
72
73 }
74
75}