Path: blob/master/src/applications/differential/xaction/DifferentialRevisionBuildableTransaction.php
12256 views
<?php12final class DifferentialRevisionBuildableTransaction3extends DifferentialRevisionTransactionType {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 $object->getBuildableStatus($this->getBuildablePHID());15}1617public function applyInternalEffects($object, $value) {18$object->setBuildableStatus($this->getBuildablePHID(), $value);19}2021public function getIcon() {22return $this->newBuildableStatus()->getIcon();23}2425public function getColor() {26return $this->newBuildableStatus()->getColor();27}2829public function getActionName() {30return $this->newBuildableStatus()->getActionName();31}3233public function shouldHideForFeed() {34return !$this->newBuildableStatus()->isFailed();35}3637public function shouldHideForMail() {38return !$this->newBuildableStatus()->isFailed();39}4041public function getTitle() {42$new = $this->getNewValue();43$buildable_phid = $this->getBuildablePHID();4445switch ($new) {46case HarbormasterBuildableStatus::STATUS_PASSED:47return pht(48'%s completed remote builds in %s.',49$this->renderAuthor(),50$this->renderHandle($buildable_phid));51case HarbormasterBuildableStatus::STATUS_FAILED:52return pht(53'%s failed remote builds in %s!',54$this->renderAuthor(),55$this->renderHandle($buildable_phid));56}5758return null;59}6061public function getTitleForFeed() {62$new = $this->getNewValue();63$buildable_phid = $this->getBuildablePHID();6465switch ($new) {66case HarbormasterBuildableStatus::STATUS_PASSED:67return pht(68'%s completed remote builds in %s for %s.',69$this->renderAuthor(),70$this->renderHandle($buildable_phid),71$this->renderObject());72case HarbormasterBuildableStatus::STATUS_FAILED:73return pht(74'%s failed remote builds in %s for %s!',75$this->renderAuthor(),76$this->renderHandle($buildable_phid),77$this->renderObject());78}7980return null;81}8283private function newBuildableStatus() {84$new = $this->getNewValue();85return HarbormasterBuildableStatus::newBuildableStatusObject($new);86}8788private function getBuildablePHID() {89return $this->getMetadataValue('harbormaster:buildablePHID');90}9192}939495