Page MenuHomePhabricator

D18014.diff
No OneTemporary

D18014.diff

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -3716,6 +3716,7 @@
'PhabricatorProjectWatchController' => 'applications/project/controller/PhabricatorProjectWatchController.php',
'PhabricatorProjectWatcherListView' => 'applications/project/view/PhabricatorProjectWatcherListView.php',
'PhabricatorProjectWorkboardBackgroundColor' => 'applications/project/constants/PhabricatorProjectWorkboardBackgroundColor.php',
+ 'PhabricatorProjectWorkboardBackgroundTransaction' => 'applications/project/xaction/PhabricatorProjectWorkboardBackgroundTransaction.php',
'PhabricatorProjectWorkboardProfileMenuItem' => 'applications/project/menuitem/PhabricatorProjectWorkboardProfileMenuItem.php',
'PhabricatorProjectWorkboardTransaction' => 'applications/project/xaction/PhabricatorProjectWorkboardTransaction.php',
'PhabricatorProjectsAncestorsSearchEngineAttachment' => 'applications/project/engineextension/PhabricatorProjectsAncestorsSearchEngineAttachment.php',
@@ -9166,6 +9167,7 @@
'PhabricatorProjectWatchController' => 'PhabricatorProjectController',
'PhabricatorProjectWatcherListView' => 'PhabricatorProjectUserListView',
'PhabricatorProjectWorkboardBackgroundColor' => 'Phobject',
+ 'PhabricatorProjectWorkboardBackgroundTransaction' => 'PhabricatorProjectTransactionType',
'PhabricatorProjectWorkboardProfileMenuItem' => 'PhabricatorProfileMenuItem',
'PhabricatorProjectWorkboardTransaction' => 'PhabricatorProjectTransactionType',
'PhabricatorProjectsAncestorsSearchEngineAttachment' => 'PhabricatorSearchEngineAttachment',
diff --git a/src/applications/project/controller/PhabricatorProjectBoardBackgroundController.php b/src/applications/project/controller/PhabricatorProjectBoardBackgroundController.php
--- a/src/applications/project/controller/PhabricatorProjectBoardBackgroundController.php
+++ b/src/applications/project/controller/PhabricatorProjectBoardBackgroundController.php
@@ -37,7 +37,8 @@
$xactions = array();
$xactions[] = id(new PhabricatorProjectTransaction())
- ->setTransactionType(PhabricatorProjectTransaction::TYPE_BACKGROUND)
+ ->setTransactionType(
+ PhabricatorProjectWorkboardBackgroundTransaction::TRANSACTIONTYPE)
->setNewValue($background_key);
id(new PhabricatorProjectTransactionEditor())
diff --git a/src/applications/project/editor/PhabricatorProjectTransactionEditor.php b/src/applications/project/editor/PhabricatorProjectTransactionEditor.php
--- a/src/applications/project/editor/PhabricatorProjectTransactionEditor.php
+++ b/src/applications/project/editor/PhabricatorProjectTransactionEditor.php
@@ -30,67 +30,9 @@
$types[] = PhabricatorTransactions::TYPE_EDIT_POLICY;
$types[] = PhabricatorTransactions::TYPE_JOIN_POLICY;
- $types[] = PhabricatorProjectTransaction::TYPE_BACKGROUND;
-
return $types;
}
- protected function getCustomTransactionOldValue(
- PhabricatorLiskDAO $object,
- PhabricatorApplicationTransaction $xaction) {
-
- switch ($xaction->getTransactionType()) {
- case PhabricatorProjectTransaction::TYPE_BACKGROUND:
- return $object->getWorkboardBackgroundColor();
- }
-
- return parent::getCustomTransactionOldValue($object, $xaction);
- }
-
- protected function getCustomTransactionNewValue(
- PhabricatorLiskDAO $object,
- PhabricatorApplicationTransaction $xaction) {
-
- switch ($xaction->getTransactionType()) {
- case PhabricatorProjectTransaction::TYPE_BACKGROUND:
- $value = $xaction->getNewValue();
- if (!strlen($value)) {
- return null;
- }
- return $value;
- }
-
- return parent::getCustomTransactionNewValue($object, $xaction);
- }
-
- protected function applyCustomInternalTransaction(
- PhabricatorLiskDAO $object,
- PhabricatorApplicationTransaction $xaction) {
-
- switch ($xaction->getTransactionType()) {
- case PhabricatorProjectTransaction::TYPE_BACKGROUND:
- $object->setWorkboardBackgroundColor($xaction->getNewValue());
- return;
- }
-
- return parent::applyCustomInternalTransaction($object, $xaction);
- }
-
- protected function applyCustomExternalTransaction(
- PhabricatorLiskDAO $object,
- PhabricatorApplicationTransaction $xaction) {
-
- $old = $xaction->getOldValue();
- $new = $xaction->getNewValue();
-
- switch ($xaction->getTransactionType()) {
- case PhabricatorProjectTransaction::TYPE_BACKGROUND:
- return;
- }
-
- return parent::applyCustomExternalTransaction($object, $xaction);
- }
-
protected function validateAllTransactions(
PhabricatorLiskDAO $object,
array $xactions) {
diff --git a/src/applications/project/storage/PhabricatorProjectTransaction.php b/src/applications/project/storage/PhabricatorProjectTransaction.php
--- a/src/applications/project/storage/PhabricatorProjectTransaction.php
+++ b/src/applications/project/storage/PhabricatorProjectTransaction.php
@@ -3,8 +3,6 @@
final class PhabricatorProjectTransaction
extends PhabricatorModularTransaction {
- const TYPE_BACKGROUND = 'project:background';
-
// NOTE: This is deprecated, members are just a normal edge now.
const TYPE_MEMBERS = 'project:members';
@@ -56,22 +54,12 @@
return parent::shouldHide();
}
- public function shouldHideForFeed() {
- switch ($this->getTransactionType()) {
- case self::TYPE_BACKGROUND:
- return true;
- }
-
- return parent::shouldHideForFeed();
- }
-
-
public function shouldHideForMail(array $xactions) {
switch ($this->getTransactionType()) {
case PhabricatorProjectWorkboardTransaction::TRANSACTIONTYPE:
case PhabricatorProjectSortTransaction::TRANSACTIONTYPE:
case PhabricatorProjectFilterTransaction::TRANSACTIONTYPE:
- case self::TYPE_BACKGROUND:
+ case PhabricatorProjectWorkboardBackgroundTransaction::TRANSACTIONTYPE:
return true;
}
@@ -136,11 +124,6 @@
}
}
break;
-
- case self::TYPE_BACKGROUND:
- return pht(
- '%s changed the background color of the project workboard.',
- $author_handle);
}
return parent::getTitle();
diff --git a/src/applications/project/xaction/PhabricatorProjectWorkboardBackgroundTransaction.php b/src/applications/project/xaction/PhabricatorProjectWorkboardBackgroundTransaction.php
new file mode 100644
--- /dev/null
+++ b/src/applications/project/xaction/PhabricatorProjectWorkboardBackgroundTransaction.php
@@ -0,0 +1,26 @@
+<?php
+
+final class PhabricatorProjectWorkboardBackgroundTransaction
+ extends PhabricatorProjectTransactionType {
+
+ const TRANSACTIONTYPE = 'project:background';
+
+ public function generateOldValue($object) {
+ return $object->getWorkboardBackgroundColor();
+ }
+
+ public function applyInternalEffects($object, $value) {
+ $object->setWorkboardBackgroundColor($value);
+ }
+
+ public function getTitle() {
+ return pht(
+ '%s changed the background color of the project workboard.',
+ $this->renderAuthor());
+ }
+
+ public function shouldHide() {
+ return true;
+ }
+
+}

File Metadata

Mime Type
text/plain
Expires
Thu, Mar 20, 6:50 AM (2 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7712708
Default Alt Text
D18014.diff (7 KB)

Event Timeline