Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14097313
D18013.id43325.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
9 KB
Referenced Files
None
Subscribers
None
D18013.id43325.diff
View Options
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
@@ -3629,6 +3629,7 @@
'PhabricatorProjectEditController' => 'applications/project/controller/PhabricatorProjectEditController.php',
'PhabricatorProjectEditEngine' => 'applications/project/engine/PhabricatorProjectEditEngine.php',
'PhabricatorProjectEditPictureController' => 'applications/project/controller/PhabricatorProjectEditPictureController.php',
+ 'PhabricatorProjectFilterTransaction' => 'applications/project/xaction/PhabricatorProjectFilterTransaction.php',
'PhabricatorProjectFulltextEngine' => 'applications/project/search/PhabricatorProjectFulltextEngine.php',
'PhabricatorProjectHeraldAction' => 'applications/project/herald/PhabricatorProjectHeraldAction.php',
'PhabricatorProjectHeraldAdapter' => 'applications/project/herald/PhabricatorProjectHeraldAdapter.php',
@@ -3687,6 +3688,7 @@
'PhabricatorProjectSilencedEdgeType' => 'applications/project/edge/PhabricatorProjectSilencedEdgeType.php',
'PhabricatorProjectSlug' => 'applications/project/storage/PhabricatorProjectSlug.php',
'PhabricatorProjectSlugsTransaction' => 'applications/project/xaction/PhabricatorProjectSlugsTransaction.php',
+ 'PhabricatorProjectSortTransaction' => 'applications/project/xaction/PhabricatorProjectSortTransaction.php',
'PhabricatorProjectStandardCustomField' => 'applications/project/customfield/PhabricatorProjectStandardCustomField.php',
'PhabricatorProjectStatus' => 'applications/project/constants/PhabricatorProjectStatus.php',
'PhabricatorProjectStatusTransaction' => 'applications/project/xaction/PhabricatorProjectStatusTransaction.php',
@@ -9068,6 +9070,7 @@
'PhabricatorProjectEditController' => 'PhabricatorProjectController',
'PhabricatorProjectEditEngine' => 'PhabricatorEditEngine',
'PhabricatorProjectEditPictureController' => 'PhabricatorProjectController',
+ 'PhabricatorProjectFilterTransaction' => 'PhabricatorProjectTransactionType',
'PhabricatorProjectFulltextEngine' => 'PhabricatorFulltextEngine',
'PhabricatorProjectHeraldAction' => 'HeraldAction',
'PhabricatorProjectHeraldAdapter' => 'HeraldAdapter',
@@ -9125,6 +9128,7 @@
'PhabricatorProjectSilencedEdgeType' => 'PhabricatorEdgeType',
'PhabricatorProjectSlug' => 'PhabricatorProjectDAO',
'PhabricatorProjectSlugsTransaction' => 'PhabricatorProjectTransactionType',
+ 'PhabricatorProjectSortTransaction' => 'PhabricatorProjectTransactionType',
'PhabricatorProjectStandardCustomField' => array(
'PhabricatorProjectCustomField',
'PhabricatorStandardCustomFieldInterface',
diff --git a/src/applications/project/controller/PhabricatorProjectDefaultController.php b/src/applications/project/controller/PhabricatorProjectDefaultController.php
--- a/src/applications/project/controller/PhabricatorProjectDefaultController.php
+++ b/src/applications/project/controller/PhabricatorProjectDefaultController.php
@@ -32,7 +32,7 @@
$button = pht('Save Default Filter');
$xaction_value = $request->getStr('filter');
- $xaction_type = PhabricatorProjectTransaction::TYPE_DEFAULT_FILTER;
+ $xaction_type = PhabricatorProjectFilterTransaction::TRANSACTIONTYPE;
break;
case 'sort':
$title = pht('Set Board Default Order');
@@ -43,7 +43,7 @@
$button = pht('Save Default Order');
$xaction_value = $request->getStr('order');
- $xaction_type = PhabricatorProjectTransaction::TYPE_DEFAULT_SORT;
+ $xaction_type = PhabricatorProjectSortTransaction::TRANSACTIONTYPE;
break;
default:
return new Aphront404Response();
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,8 +30,6 @@
$types[] = PhabricatorTransactions::TYPE_EDIT_POLICY;
$types[] = PhabricatorTransactions::TYPE_JOIN_POLICY;
- $types[] = PhabricatorProjectTransaction::TYPE_DEFAULT_SORT;
- $types[] = PhabricatorProjectTransaction::TYPE_DEFAULT_FILTER;
$types[] = PhabricatorProjectTransaction::TYPE_BACKGROUND;
return $types;
@@ -42,10 +40,6 @@
PhabricatorApplicationTransaction $xaction) {
switch ($xaction->getTransactionType()) {
- case PhabricatorProjectTransaction::TYPE_DEFAULT_SORT:
- return $object->getDefaultWorkboardSort();
- case PhabricatorProjectTransaction::TYPE_DEFAULT_FILTER:
- return $object->getDefaultWorkboardFilter();
case PhabricatorProjectTransaction::TYPE_BACKGROUND:
return $object->getWorkboardBackgroundColor();
}
@@ -58,9 +52,6 @@
PhabricatorApplicationTransaction $xaction) {
switch ($xaction->getTransactionType()) {
- case PhabricatorProjectTransaction::TYPE_DEFAULT_SORT:
- case PhabricatorProjectTransaction::TYPE_DEFAULT_FILTER:
- return $xaction->getNewValue();
case PhabricatorProjectTransaction::TYPE_BACKGROUND:
$value = $xaction->getNewValue();
if (!strlen($value)) {
@@ -77,12 +68,6 @@
PhabricatorApplicationTransaction $xaction) {
switch ($xaction->getTransactionType()) {
- case PhabricatorProjectTransaction::TYPE_DEFAULT_SORT:
- $object->setDefaultWorkboardSort($xaction->getNewValue());
- return;
- case PhabricatorProjectTransaction::TYPE_DEFAULT_FILTER:
- $object->setDefaultWorkboardFilter($xaction->getNewValue());
- return;
case PhabricatorProjectTransaction::TYPE_BACKGROUND:
$object->setWorkboardBackgroundColor($xaction->getNewValue());
return;
@@ -99,8 +84,6 @@
$new = $xaction->getNewValue();
switch ($xaction->getTransactionType()) {
- case PhabricatorProjectTransaction::TYPE_DEFAULT_SORT:
- case PhabricatorProjectTransaction::TYPE_DEFAULT_FILTER:
case PhabricatorProjectTransaction::TYPE_BACKGROUND:
return;
}
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_DEFAULT_SORT = 'project:sort';
- const TYPE_DEFAULT_FILTER = 'project:filter';
const TYPE_BACKGROUND = 'project:background';
// NOTE: This is deprecated, members are just a normal edge now.
@@ -60,8 +58,6 @@
public function shouldHideForFeed() {
switch ($this->getTransactionType()) {
- case self::TYPE_DEFAULT_SORT:
- case self::TYPE_DEFAULT_FILTER:
case self::TYPE_BACKGROUND:
return true;
}
@@ -69,11 +65,12 @@
return parent::shouldHideForFeed();
}
+
public function shouldHideForMail(array $xactions) {
switch ($this->getTransactionType()) {
case PhabricatorProjectWorkboardTransaction::TRANSACTIONTYPE:
- case self::TYPE_DEFAULT_SORT:
- case self::TYPE_DEFAULT_FILTER:
+ case PhabricatorProjectSortTransaction::TRANSACTIONTYPE:
+ case PhabricatorProjectFilterTransaction::TRANSACTIONTYPE:
case self::TYPE_BACKGROUND:
return true;
}
@@ -140,16 +137,6 @@
}
break;
- case self::TYPE_DEFAULT_SORT:
- return pht(
- '%s changed the default sort order for the project workboard.',
- $author_handle);
-
- case self::TYPE_DEFAULT_FILTER:
- return pht(
- '%s changed the default filter for the project workboard.',
- $author_handle);
-
case self::TYPE_BACKGROUND:
return pht(
'%s changed the background color of the project workboard.',
diff --git a/src/applications/project/xaction/PhabricatorProjectFilterTransaction.php b/src/applications/project/xaction/PhabricatorProjectFilterTransaction.php
new file mode 100644
--- /dev/null
+++ b/src/applications/project/xaction/PhabricatorProjectFilterTransaction.php
@@ -0,0 +1,26 @@
+<?php
+
+final class PhabricatorProjectFilterTransaction
+ extends PhabricatorProjectTransactionType {
+
+ const TRANSACTIONTYPE = 'project:filter';
+
+ public function generateOldValue($object) {
+ return $object->getDefaultWorkboardFilter();
+ }
+
+ public function applyInternalEffects($object, $value) {
+ $object->setDefaultWorkboardFilter($value);
+ }
+
+ public function getTitle() {
+ return pht(
+ '%s changed the default filter for the project workboard.',
+ $this->renderAuthor());
+ }
+
+ public function shouldHide() {
+ return true;
+ }
+
+}
diff --git a/src/applications/project/xaction/PhabricatorProjectSortTransaction.php b/src/applications/project/xaction/PhabricatorProjectSortTransaction.php
new file mode 100644
--- /dev/null
+++ b/src/applications/project/xaction/PhabricatorProjectSortTransaction.php
@@ -0,0 +1,26 @@
+<?php
+
+final class PhabricatorProjectSortTransaction
+ extends PhabricatorProjectTransactionType {
+
+ const TRANSACTIONTYPE = 'project:sort';
+
+ public function generateOldValue($object) {
+ return $object->getDefaultWorkboardSort();
+ }
+
+ public function applyInternalEffects($object, $value) {
+ $object->setDefaultWorkboardSort($value);
+ }
+
+ public function getTitle() {
+ return pht(
+ '%s changed the default sort order for the project workboard.',
+ $this->renderAuthor());
+ }
+
+ public function shouldHide() {
+ return true;
+ }
+
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 27, 6:38 AM (16 h, 14 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6792329
Default Alt Text
D18013.id43325.diff (9 KB)
Attached To
Mode
D18013: Migrate Project sort and filter defaults to modular transactions
Attached
Detach File
Event Timeline
Log In to Comment