mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-19 12:00: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:
parent
06882a99cf
commit
0e15393b46
3 changed files with 23 additions and 12 deletions
|
@ -126,17 +126,28 @@ final class HarbormasterBuildViewController
|
||||||
|
|
||||||
$target_box->addPropertyList($properties, pht('Overview'));
|
$target_box->addPropertyList($properties, pht('Overview'));
|
||||||
|
|
||||||
$description = $build_target->getBuildStep()->getDescription();
|
$step = $build_target->getBuildStep();
|
||||||
if ($description) {
|
|
||||||
$rendered = PhabricatorMarkupEngine::renderOneObject(
|
|
||||||
id(new PhabricatorMarkupOneOff())
|
|
||||||
->setContent($description)
|
|
||||||
->setPreserveLinebreaks(true),
|
|
||||||
'default',
|
|
||||||
$viewer);
|
|
||||||
|
|
||||||
$properties->addSectionHeader(pht('Description'));
|
if ($step) {
|
||||||
$properties->addTextContent($rendered);
|
$description = $step->getDescription();
|
||||||
|
if ($description) {
|
||||||
|
$rendered = PhabricatorMarkupEngine::renderOneObject(
|
||||||
|
id(new PhabricatorMarkupOneOff())
|
||||||
|
->setContent($description)
|
||||||
|
->setPreserveLinebreaks(true),
|
||||||
|
'default',
|
||||||
|
$viewer);
|
||||||
|
|
||||||
|
$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();
|
$details = $build_target->getDetails();
|
||||||
|
|
|
@ -103,7 +103,7 @@ final class HarbormasterBuildTargetQuery
|
||||||
|
|
||||||
foreach ($page as $target) {
|
foreach ($page as $target) {
|
||||||
$target->attachBuildStep(
|
$target->attachBuildStep(
|
||||||
$steps[$target->getBuildStepPHID()]);
|
idx($steps, $target->getBuildStepPHID()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -117,7 +117,7 @@ final class HarbormasterBuildTarget extends HarbormasterDAO
|
||||||
return $this->assertAttached($this->build);
|
return $this->assertAttached($this->build);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function attachBuildStep(HarbormasterBuildStep $step) {
|
public function attachBuildStep(HarbormasterBuildStep $step = null) {
|
||||||
$this->buildStep = $step;
|
$this->buildStep = $step;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue