Differential D21699 Diff 51710 src/applications/harbormaster/xaction/build/HarbormasterBuildMessageResumeTransaction.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/harbormaster/xaction/build/HarbormasterBuildMessageResumeTransaction.php
Show First 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | public function applyInternalEffects($object, $value) { | ||||
$build->setBuildStatus(HarbormasterBuildStatus::STATUS_BUILDING); | $build->setBuildStatus(HarbormasterBuildStatus::STATUS_BUILDING); | ||||
} | } | ||||
protected function newCanApplyMessageAssertion( | protected function newCanApplyMessageAssertion( | ||||
PhabricatorUser $viewer, | PhabricatorUser $viewer, | ||||
HarbormasterBuild $build) { | HarbormasterBuild $build) { | ||||
if ($build->isAutobuild()) { | if ($build->isAutobuild()) { | ||||
throw new HarbormasterRestartException( | throw new HarbormasterMessageException( | ||||
pht('Unable to Resume Build'), | pht('Unable to Resume Build'), | ||||
pht( | pht( | ||||
'You can not resume a build that uses an autoplan.')); | 'You can not resume a build that uses an autoplan.')); | ||||
} | } | ||||
if (!$build->isPaused() && !$build->isPausing()) { | if (!$build->isPaused() && !$build->isPausing()) { | ||||
throw new HarbormasterRestartException( | throw new HarbormasterMessageException( | ||||
pht('Unable to Resume Build'), | pht('Unable to Resume Build'), | ||||
pht( | pht( | ||||
'You can not resume this build because it is not paused. You can '. | 'You can not resume this build because it is not paused. You can '. | ||||
'only resume a paused build.')); | 'only resume a paused build.')); | ||||
} | } | ||||
} | } | ||||
protected function newCanSendMessageAssertion( | protected function newCanSendMessageAssertion( | ||||
PhabricatorUser $viewer, | PhabricatorUser $viewer, | ||||
HarbormasterBuild $build) { | HarbormasterBuild $build) { | ||||
if ($build->isResuming()) { | if ($build->isResuming()) { | ||||
throw new HarbormasterRestartException( | throw new HarbormasterMessageException( | ||||
pht('Unable to Resume Build'), | pht('Unable to Resume Build'), | ||||
pht( | pht( | ||||
'You can not resume this build beacuse it is already resuming.')); | 'You can not resume this build beacuse it is already resuming.')); | ||||
} | } | ||||
if ($build->isRestarting()) { | if ($build->isRestarting()) { | ||||
throw new HarbormasterRestartException( | throw new HarbormasterMessageException( | ||||
pht('Unable to Resume Build'), | pht('Unable to Resume Build'), | ||||
pht('You can not resume this build because it is already restarting.')); | pht('You can not resume this build because it is already restarting.')); | ||||
} | } | ||||
if ($build->isAborting()) { | if ($build->isAborting()) { | ||||
throw new HarbormasterRestartException( | throw new HarbormasterMessageException( | ||||
pht('Unable to Resume Build'), | pht('Unable to Resume Build'), | ||||
pht('You can not resume this build because it is already aborting.')); | pht('You can not resume this build because it is already aborting.')); | ||||
} | } | ||||
} | } | ||||
} | } |