3 final class DifferentialRevisionBuildableTransaction
4 extends DifferentialRevisionTransactionType
{
6 // NOTE: This uses an older constant for compatibility. We should perhaps
7 // migrate these at some point.
8 const TRANSACTIONTYPE
= 'harbormaster:buildable';
10 public function generateNewValue($object, $value) {
14 public function generateOldValue($object) {
15 return $object->getBuildableStatus($this->getBuildablePHID());
18 public function applyInternalEffects($object, $value) {
19 $object->setBuildableStatus($this->getBuildablePHID(), $value);
22 public function getIcon() {
23 return $this->newBuildableStatus()->getIcon();
26 public function getColor() {
27 return $this->newBuildableStatus()->getColor();
30 public function getActionName() {
31 return $this->newBuildableStatus()->getActionName();
34 public function shouldHideForFeed() {
35 return !$this->newBuildableStatus()->isFailed();
38 public function shouldHideForMail() {
39 return !$this->newBuildableStatus()->isFailed();
42 public function getTitle() {
43 $new = $this->getNewValue();
44 $buildable_phid = $this->getBuildablePHID();
47 case HarbormasterBuildableStatus
::STATUS_PASSED
:
49 '%s completed remote builds in %s.',
50 $this->renderAuthor(),
51 $this->renderHandle($buildable_phid));
52 case HarbormasterBuildableStatus
::STATUS_FAILED
:
54 '%s failed remote builds in %s!',
55 $this->renderAuthor(),
56 $this->renderHandle($buildable_phid));
62 public function getTitleForFeed() {
63 $new = $this->getNewValue();
64 $buildable_phid = $this->getBuildablePHID();
67 case HarbormasterBuildableStatus
::STATUS_PASSED
:
69 '%s completed remote builds in %s for %s.',
70 $this->renderAuthor(),
71 $this->renderHandle($buildable_phid),
72 $this->renderObject());
73 case HarbormasterBuildableStatus
::STATUS_FAILED
:
75 '%s failed remote builds in %s for %s!',
76 $this->renderAuthor(),
77 $this->renderHandle($buildable_phid),
78 $this->renderObject());
84 private function newBuildableStatus() {
85 $new = $this->getNewValue();
86 return HarbormasterBuildableStatus
::newBuildableStatusObject($new);
89 private function getBuildablePHID() {
90 return $this->getMetadataValue('harbormaster:buildablePHID');