Path: blob/master/src/applications/diffusion/xaction/DiffusionCommitBuildableTransaction.php
12241 views
<?php12final class DiffusionCommitBuildableTransaction3extends DiffusionCommitTransactionType {45// NOTE: This uses an older constant for compatibility. We should perhaps6// migrate these at some point.7const TRANSACTIONTYPE = 'harbormaster:buildable';89public function generateNewValue($object, $value) {10return $value;11}1213public function generateOldValue($object) {14return null;15}1617public function getIcon() {18return $this->newBuildableStatus()->getIcon();19}2021public function getColor() {22return $this->newBuildableStatus()->getColor();23}2425public function getActionName() {26return $this->newBuildableStatus()->getActionName();27}2829public function shouldHideForFeed() {30return !$this->newBuildableStatus()->isFailed();31}3233public function shouldHideForMail() {34return !$this->newBuildableStatus()->isFailed();35}3637public function getTitle() {38$new = $this->getNewValue();39$buildable_phid = $this->getBuildablePHID();4041switch ($new) {42case HarbormasterBuildableStatus::STATUS_PASSED:43return pht(44'%s completed building %s.',45$this->renderAuthor(),46$this->renderHandle($buildable_phid));47case HarbormasterBuildableStatus::STATUS_FAILED:48return pht(49'%s failed to build %s!',50$this->renderAuthor(),51$this->renderHandle($buildable_phid));52}5354return null;55}5657public function getTitleForFeed() {58$new = $this->getNewValue();59$buildable_phid = $this->getBuildablePHID();6061switch ($new) {62case HarbormasterBuildableStatus::STATUS_PASSED:63return pht(64'%s completed building %s for %s.',65$this->renderAuthor(),66$this->renderHandle($buildable_phid),67$this->renderObject());68case HarbormasterBuildableStatus::STATUS_FAILED:69return pht(70'%s failed to build %s for %s!',71$this->renderAuthor(),72$this->renderHandle($buildable_phid),73$this->renderObject());74}7576return null;77}7879private function newBuildableStatus() {80$new = $this->getNewValue();81return HarbormasterBuildableStatus::newBuildableStatusObject($new);82}8384private function getBuildablePHID() {85return $this->getMetadataValue('harbormaster:buildablePHID');86}8788}899091