Correct Aphlict websocket URI construction after PHP8 compatibility changes
[phabricator.git] / src / applications / harbormaster / controller / HarbormasterUnitMessageListController.php
bloba87d17c4fadedc1d69ffa2b46ee34a967442fb70
1 <?php
3 final class HarbormasterUnitMessageListController
4 extends HarbormasterController {
6 public function shouldAllowPublic() {
7 return true;
10 public function handleRequest(AphrontRequest $request) {
11 $viewer = $this->getViewer();
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();
23 $id = $buildable->getID();
25 $target_phids = array();
26 foreach ($buildable->getBuilds() as $build) {
27 foreach ($build->getBuildTargets() as $target) {
28 $target_phids[] = $target->getPHID();
32 $unit_data = array();
33 if ($target_phids) {
34 $unit_data = id(new HarbormasterBuildUnitMessageQuery())
35 ->setViewer($viewer)
36 ->withBuildTargetPHIDs($target_phids)
37 ->execute();
38 } else {
39 $unit_data = array();
42 $unit = id(new HarbormasterUnitSummaryView())
43 ->setViewer($viewer)
44 ->setBuildable($buildable)
45 ->setUnitMessages($unit_data);
47 $crumbs = $this->buildApplicationCrumbs();
48 $this->addBuildableCrumb($crumbs, $buildable);
49 $crumbs->addTextCrumb(pht('Unit Tests'));
50 $crumbs->setBorder(true);
52 $title = array(
53 $buildable->getMonogram(),
54 pht('Unit Tests'),
57 $header = id(new PHUIHeaderView())
58 ->setHeader($buildable->getMonogram().' '.pht('Unit Tests'));
60 $view = id(new PHUITwoColumnView())
61 ->setHeader($header)
62 ->setFooter(array(
63 $unit,
64 ));
66 return $this->newPage()
67 ->setTitle($title)
68 ->setCrumbs($crumbs)
69 ->appendChild($view);