1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 22:10:55 +01:00

Prevent crash when build step has been deleted on build plan

Summary: This prevents crashes when looking at builds, where the build steps have been deleted on the build plan since the build was run.  Currently the only information that's pulled from the build step is the description (because this was too large to copy to every target).

Test Plan: Tested it locally.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D10361
This commit is contained in:
James Rhodes 2014-08-28 08:20:11 +10:00
parent 06882a99cf
commit 0e15393b46
3 changed files with 23 additions and 12 deletions

View file

@ -126,7 +126,10 @@ final class HarbormasterBuildViewController
$target_box->addPropertyList($properties, pht('Overview'));
$description = $build_target->getBuildStep()->getDescription();
$step = $build_target->getBuildStep();
if ($step) {
$description = $step->getDescription();
if ($description) {
$rendered = PhabricatorMarkupEngine::renderOneObject(
id(new PhabricatorMarkupOneOff())
@ -138,6 +141,14 @@ final class HarbormasterBuildViewController
$properties->addSectionHeader(pht('Description'));
$properties->addTextContent($rendered);
}
} else {
$target_box->setFormErrors(
array(
pht(
'This build step has since been deleted on the build plan. '.
'Some information may be omitted.'),
));
}
$details = $build_target->getDetails();
if ($details) {

View file

@ -103,7 +103,7 @@ final class HarbormasterBuildTargetQuery
foreach ($page as $target) {
$target->attachBuildStep(
$steps[$target->getBuildStepPHID()]);
idx($steps, $target->getBuildStepPHID()));
}
}

View file

@ -117,7 +117,7 @@ final class HarbormasterBuildTarget extends HarbormasterDAO
return $this->assertAttached($this->build);
}
public function attachBuildStep(HarbormasterBuildStep $step) {
public function attachBuildStep(HarbormasterBuildStep $step = null) {
$this->buildStep = $step;
return $this;
}