Page MenuHomePhabricator

D8791.id20864.diff
No OneTemporary

D8791.id20864.diff

diff --git a/src/applications/harbormaster/controller/HarbormasterStepEditController.php b/src/applications/harbormaster/controller/HarbormasterStepEditController.php
--- a/src/applications/harbormaster/controller/HarbormasterStepEditController.php
+++ b/src/applications/harbormaster/controller/HarbormasterStepEditController.php
@@ -81,6 +81,13 @@
// if we create plans elsewhere.
$steps = $plan->loadOrderedBuildSteps();
$step->setSequence(count($steps) + 1);
+
+ // When creating a new step, make sure we have a create transaction
+ // so we'll apply the transactions even if the step has no
+ // configurable options.
+ $create_xaction = id(new HarbormasterBuildStepTransaction())
+ ->setTransactionType(HarbormasterBuildStepTransaction::TYPE_CREATE);
+ array_unshift($xactions, $create_xaction);
}
try {
diff --git a/src/applications/harbormaster/editor/HarbormasterBuildStepEditor.php b/src/applications/harbormaster/editor/HarbormasterBuildStepEditor.php
--- a/src/applications/harbormaster/editor/HarbormasterBuildStepEditor.php
+++ b/src/applications/harbormaster/editor/HarbormasterBuildStepEditor.php
@@ -3,4 +3,60 @@
final class HarbormasterBuildStepEditor
extends PhabricatorApplicationTransactionEditor {
+ public function getTransactionTypes() {
+ $types = parent::getTransactionTypes();
+
+ $types[] = HarbormasterBuildStepTransaction::TYPE_CREATE;
+
+ return $types;
+ }
+
+ protected function getCustomTransactionOldValue(
+ PhabricatorLiskDAO $object,
+ PhabricatorApplicationTransaction $xaction) {
+
+ switch ($xaction->getTransactionType()) {
+ case HarbormasterBuildStepTransaction::TYPE_CREATE:
+ return null;
+ }
+
+ return parent::getCustomTransactionOldValue($object, $xaction);
+ }
+
+ protected function getCustomTransactionNewValue(
+ PhabricatorLiskDAO $object,
+ PhabricatorApplicationTransaction $xaction) {
+
+ switch ($xaction->getTransactionType()) {
+ case HarbormasterBuildStepTransaction::TYPE_CREATE:
+ return true;
+ }
+
+ return parent::getCustomTransactionNewValue($object, $xaction);
+ }
+
+ protected function applyCustomInternalTransaction(
+ PhabricatorLiskDAO $object,
+ PhabricatorApplicationTransaction $xaction) {
+
+ switch ($xaction->getTransactionType()) {
+ case HarbormasterBuildStepTransaction::TYPE_CREATE:
+ return;
+ }
+
+ return parent::applyCustomInternalTransaction($object, $xaction);
+ }
+
+ protected function applyCustomExternalTransaction(
+ PhabricatorLiskDAO $object,
+ PhabricatorApplicationTransaction $xaction) {
+
+ switch ($xaction->getTransactionType()) {
+ case HarbormasterBuildStepTransaction::TYPE_CREATE:
+ return;
+ }
+
+ return parent::applyCustomExternalTransaction($object, $xaction);
+ }
+
}
diff --git a/src/applications/harbormaster/storage/configuration/HarbormasterBuildStepTransaction.php b/src/applications/harbormaster/storage/configuration/HarbormasterBuildStepTransaction.php
--- a/src/applications/harbormaster/storage/configuration/HarbormasterBuildStepTransaction.php
+++ b/src/applications/harbormaster/storage/configuration/HarbormasterBuildStepTransaction.php
@@ -3,6 +3,8 @@
final class HarbormasterBuildStepTransaction
extends PhabricatorApplicationTransaction {
+ const TYPE_CREATE = 'harbormaster:step:create';
+
public function getApplicationName() {
return 'harbormaster';
}
@@ -11,4 +13,48 @@
return HarbormasterPHIDTypeBuildStep::TYPECONST;
}
+ public function getTitle() {
+ $author_phid = $this->getAuthorPHID();
+
+ $old = $this->getOldValue();
+ $new = $this->getNewValue();
+
+ switch ($this->getTransactionType()) {
+ case self::TYPE_CREATE:
+ return pht(
+ '%s created this build step.',
+ $this->renderHandleLink($author_phid));
+ }
+
+ return parent::getTitle();
+ }
+
+ public function getIcon() {
+ $author_phid = $this->getAuthorPHID();
+
+ $old = $this->getOldValue();
+ $new = $this->getNewValue();
+
+ switch ($this->getTransactionType()) {
+ case self::TYPE_CREATE:
+ return 'create';
+ }
+
+ return parent::getIcon();
+ }
+
+ public function getColor() {
+ $author_phid = $this->getAuthorPHID();
+
+ $old = $this->getOldValue();
+ $new = $this->getNewValue();
+
+ switch ($this->getTransactionType()) {
+ case self::TYPE_CREATE:
+ return 'green';
+ }
+
+ return parent::getColor();
+ }
+
}

File Metadata

Mime Type
text/plain
Expires
Oct 18 2024, 11:03 AM (4 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6726534
Default Alt Text
D8791.id20864.diff (4 KB)

Event Timeline