Differential D21699 Diff 51675 src/applications/harbormaster/xaction/build/HarbormasterBuildMessagePauseTransaction.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/harbormaster/xaction/build/HarbormasterBuildMessagePauseTransaction.php
Show First 20 Lines • Show All 77 Lines • ▼ Show 20 Lines | public function applyInternalEffects($object, $value) { | ||||
$build->setBuildStatus(HarbormasterBuildStatus::STATUS_PAUSED); | $build->setBuildStatus(HarbormasterBuildStatus::STATUS_PAUSED); | ||||
} | } | ||||
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 Pause Build'), | pht('Unable to Pause Build'), | ||||
pht('You can not pause a build that uses an autoplan.')); | pht('You can not pause a build that uses an autoplan.')); | ||||
} | } | ||||
if ($build->isPaused()) { | if ($build->isPaused()) { | ||||
throw new HarbormasterRestartException( | throw new HarbormasterMessageException( | ||||
pht('Unable to Pause Build'), | pht('Unable to Pause Build'), | ||||
pht('You can not pause this build because it is already paused.')); | pht('You can not pause this build because it is already paused.')); | ||||
} | } | ||||
if ($build->isComplete()) { | if ($build->isComplete()) { | ||||
throw new HarbormasterRestartException( | throw new HarbormasterMessageException( | ||||
pht('Unable to Pause Build'), | pht('Unable to Pause Build'), | ||||
pht('You can not pause this build because it has already completed.')); | pht('You can not pause this build because it has already completed.')); | ||||
} | } | ||||
} | } | ||||
protected function newCanSendMessageAssertion( | protected function newCanSendMessageAssertion( | ||||
PhabricatorUser $viewer, | PhabricatorUser $viewer, | ||||
HarbormasterBuild $build) { | HarbormasterBuild $build) { | ||||
if ($build->isPausing()) { | if ($build->isPausing()) { | ||||
throw new HarbormasterRestartException( | throw new HarbormasterMessageException( | ||||
pht('Unable to Pause Build'), | pht('Unable to Pause Build'), | ||||
pht('You can not pause this build because it is already pausing.')); | pht('You can not pause this build because it is already pausing.')); | ||||
} | } | ||||
if ($build->isRestarting()) { | if ($build->isRestarting()) { | ||||
throw new HarbormasterRestartException( | throw new HarbormasterMessageException( | ||||
pht('Unable to Pause Build'), | pht('Unable to Pause Build'), | ||||
pht('You can not pause this build because it is already restarting.')); | pht('You can not pause this build because it is already restarting.')); | ||||
} | } | ||||
if ($build->isAborting()) { | if ($build->isAborting()) { | ||||
throw new HarbormasterRestartException( | throw new HarbormasterMessageException( | ||||
pht('Unable to Pause Build'), | pht('Unable to Pause Build'), | ||||
pht('You can not pause this build because it is already aborting.')); | pht('You can not pause this build because it is already aborting.')); | ||||
} | } | ||||
} | } | ||||
} | } |