diff --git a/src/applications/daemon/controller/PhabricatorWorkerTaskDetailController.php b/src/applications/daemon/controller/PhabricatorWorkerTaskDetailController.php --- a/src/applications/daemon/controller/PhabricatorWorkerTaskDetailController.php +++ b/src/applications/daemon/controller/PhabricatorWorkerTaskDetailController.php @@ -149,9 +149,9 @@ $worker = $task->getWorkerInstance(); $data = $worker->renderForDisplay($viewer); - $view->addProperty( - pht('Data'), - $data); + if ($data !== null) { + $view->addProperty(pht('Data'), $data); + } return $view; } diff --git a/src/applications/harbormaster/phid/HarbormasterBuildPHIDType.php b/src/applications/harbormaster/phid/HarbormasterBuildPHIDType.php --- a/src/applications/harbormaster/phid/HarbormasterBuildPHIDType.php +++ b/src/applications/harbormaster/phid/HarbormasterBuildPHIDType.php @@ -27,12 +27,11 @@ foreach ($handles as $phid => $handle) { $build = $objects[$phid]; - $handles[$phid]->setName(pht( - 'Build %d: %s', - $build->getID(), - $build->getName())); - $handles[$phid]->setURI( - '/harbormaster/build/'.$build->getID()); + $build_id = $build->getID(); + $name = $build->getName(); + + $handle->setName(pht('Build %d: %s', $build_id, $name)); + $handle->setURI("/harbormaster/build/{$build_id}/"); } } diff --git a/src/applications/harbormaster/phid/HarbormasterBuildTargetPHIDType.php b/src/applications/harbormaster/phid/HarbormasterBuildTargetPHIDType.php --- a/src/applications/harbormaster/phid/HarbormasterBuildTargetPHIDType.php +++ b/src/applications/harbormaster/phid/HarbormasterBuildTargetPHIDType.php @@ -26,7 +26,17 @@ array $objects) { foreach ($handles as $phid => $handle) { - $build_target = $objects[$phid]; + $target = $objects[$phid]; + $target_id = $target->getID(); + + // Build target don't currently have their own page, so just point + // the user at the build until we have one. + $build = $target->getBuild(); + $build_id = $build->getID(); + $uri = "/harbormaster/build/{$build_id}/"; + + $handle->setName(pht('Build Target %d', $target_id)); + $handle->setURI($uri); } } diff --git a/src/applications/harbormaster/worker/HarbormasterBuildWorker.php b/src/applications/harbormaster/worker/HarbormasterBuildWorker.php --- a/src/applications/harbormaster/worker/HarbormasterBuildWorker.php +++ b/src/applications/harbormaster/worker/HarbormasterBuildWorker.php @@ -5,11 +5,31 @@ */ final class HarbormasterBuildWorker extends HarbormasterWorker { + public function renderForDisplay(PhabricatorUser $viewer) { + try { + $build = $this->loadBuild(); + } catch (Exception $ex) { + return null; + } + + return $viewer->renderHandle($build->getPHID()); + } + protected function doWork() { + $viewer = $this->getViewer(); + $build = $this->loadBuild(); + + id(new HarbormasterBuildEngine()) + ->setViewer($viewer) + ->setBuild($build) + ->continueBuild(); + } + + private function loadBuild() { $data = $this->getTaskData(); $id = idx($data, 'buildID'); - $viewer = $this->getViewer(); + $viewer = $this->getViewer(); $build = id(new HarbormasterBuildQuery()) ->setViewer($viewer) ->withIDs(array($id)) @@ -19,10 +39,7 @@ pht('Invalid build ID "%s".', $id)); } - id(new HarbormasterBuildEngine()) - ->setViewer($viewer) - ->setBuild($build) - ->continueBuild(); + return $build; } } diff --git a/src/applications/harbormaster/worker/HarbormasterTargetWorker.php b/src/applications/harbormaster/worker/HarbormasterTargetWorker.php --- a/src/applications/harbormaster/worker/HarbormasterTargetWorker.php +++ b/src/applications/harbormaster/worker/HarbormasterTargetWorker.php @@ -11,6 +11,16 @@ return phutil_units('24 hours in seconds'); } + public function renderForDisplay(PhabricatorUser $viewer) { + try { + $target = $this->loadBuildTarget(); + } catch (Exception $ex) { + return null; + } + + return $viewer->renderHandle($target->getPHID()); + } + private function loadBuildTarget() { $data = $this->getTaskData(); $id = idx($data, 'targetID'); diff --git a/src/applications/repository/worker/PhabricatorRepositoryPushMailWorker.php b/src/applications/repository/worker/PhabricatorRepositoryPushMailWorker.php --- a/src/applications/repository/worker/PhabricatorRepositoryPushMailWorker.php +++ b/src/applications/repository/worker/PhabricatorRepositoryPushMailWorker.php @@ -130,11 +130,6 @@ return $target->willSendMail($mail); } - public function renderForDisplay(PhabricatorUser $viewer) { - // This data has some sensitive stuff, so don't show it. - return null; - } - private function renderRefs(array $logs) { $ref_lines = array(); $ref_list = array(); diff --git a/src/infrastructure/daemon/workers/PhabricatorWorker.php b/src/infrastructure/daemon/workers/PhabricatorWorker.php --- a/src/infrastructure/daemon/workers/PhabricatorWorker.php +++ b/src/infrastructure/daemon/workers/PhabricatorWorker.php @@ -210,8 +210,7 @@ } public function renderForDisplay(PhabricatorUser $viewer) { - $data = PhutilReadableSerializer::printableValue($this->data); - return phutil_tag('pre', array(), $data); + return null; } /** diff --git a/src/infrastructure/sms/worker/PhabricatorSMSWorker.php b/src/infrastructure/sms/worker/PhabricatorSMSWorker.php --- a/src/infrastructure/sms/worker/PhabricatorSMSWorker.php +++ b/src/infrastructure/sms/worker/PhabricatorSMSWorker.php @@ -3,9 +3,4 @@ abstract class PhabricatorSMSWorker extends PhabricatorWorker { - public function renderForDisplay(PhabricatorUser $viewer) { - // This data has some sensitive stuff, so don't show it. - return null; - } - }