Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13984010
D8791.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D8791.id.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Mon, Oct 21, 10:20 AM (4 w, 21 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6726534
Default Alt Text
D8791.id.diff (4 KB)
Attached To
Mode
D8791: Add a "Create build step" transaction to Harbormaster
Attached
Detach File
Event Timeline
Log In to Comment