diff --git a/src/applications/maniphest/controller/ManiphestBatchEditController.php b/src/applications/maniphest/controller/ManiphestBatchEditController.php index 81122cee51..f22269c10e 100644 --- a/src/applications/maniphest/controller/ManiphestBatchEditController.php +++ b/src/applications/maniphest/controller/ManiphestBatchEditController.php @@ -171,8 +171,8 @@ final class ManiphestBatchEditController extends ManiphestController { 'assign' => ManiphestTransaction::TYPE_OWNER, 'status' => ManiphestTransaction::TYPE_STATUS, 'priority' => ManiphestTransaction::TYPE_PRIORITY, - 'add_project' => ManiphestTransaction::TYPE_PROJECTS, - 'remove_project' => ManiphestTransaction::TYPE_PROJECTS, + 'add_project' => PhabricatorTransactions::TYPE_EDGE, + 'remove_project' => PhabricatorTransactions::TYPE_EDGE, 'add_ccs' => PhabricatorTransactions::TYPE_SUBSCRIBERS, 'remove_ccs' => PhabricatorTransactions::TYPE_SUBSCRIBERS, ); @@ -214,7 +214,7 @@ final class ManiphestBatchEditController extends ManiphestController { case ManiphestTransaction::TYPE_PRIORITY: $current = $task->getPriority(); break; - case ManiphestTransaction::TYPE_PROJECTS: + case PhabricatorTransactions::TYPE_EDGE: $current = $task->getProjectPHIDs(); break; case PhabricatorTransactions::TYPE_SUBSCRIBERS: @@ -243,7 +243,7 @@ final class ManiphestBatchEditController extends ManiphestController { $value = null; } break; - case ManiphestTransaction::TYPE_PROJECTS: + case PhabricatorTransactions::TYPE_EDGE: if (empty($value)) { continue 2; } @@ -275,7 +275,7 @@ final class ManiphestBatchEditController extends ManiphestController { $value = $current."\n\n".$value; } break; - case ManiphestTransaction::TYPE_PROJECTS: + case PhabricatorTransactions::TYPE_EDGE: $is_remove = $action['action'] == 'remove_project'; $current = array_fill_keys($current, true); @@ -356,12 +356,9 @@ final class ManiphestBatchEditController extends ManiphestController { id(new ManiphestTransactionComment()) ->setContent($value)); break; - case ManiphestTransaction::TYPE_PROJECTS: - - // TODO: Clean this mess up. + case PhabricatorTransactions::TYPE_EDGE: $project_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST; $xaction - ->setTransactionType(PhabricatorTransactions::TYPE_EDGE) ->setMetadataValue('edge:type', $project_type) ->setNewValue( array( diff --git a/src/applications/maniphest/controller/ManiphestTaskDetailController.php b/src/applications/maniphest/controller/ManiphestTaskDetailController.php index af85f34828..16514a6a82 100644 --- a/src/applications/maniphest/controller/ManiphestTaskDetailController.php +++ b/src/applications/maniphest/controller/ManiphestTaskDetailController.php @@ -139,7 +139,7 @@ final class ManiphestTaskDetailController extends ManiphestController { ManiphestTransaction::TYPE_OWNER => pht('Reassign / Claim'), PhabricatorTransactions::TYPE_SUBSCRIBERS => pht('Add CCs'), ManiphestTransaction::TYPE_PRIORITY => pht('Change Priority'), - ManiphestTransaction::TYPE_PROJECTS => pht('Associate Projects'), + PhabricatorTransactions::TYPE_EDGE => pht('Associate Projects'), ); // Remove actions the user doesn't have permission to take. @@ -149,7 +149,7 @@ final class ManiphestTaskDetailController extends ManiphestController { ManiphestEditAssignCapability::CAPABILITY, ManiphestTransaction::TYPE_PRIORITY => ManiphestEditPriorityCapability::CAPABILITY, - ManiphestTransaction::TYPE_PROJECTS => + PhabricatorTransactions::TYPE_EDGE => ManiphestEditProjectsCapability::CAPABILITY, ManiphestTransaction::TYPE_STATUS => ManiphestEditStatusCapability::CAPABILITY, @@ -264,7 +264,7 @@ final class ManiphestTaskDetailController extends ManiphestController { ManiphestTransaction::TYPE_OWNER => 'assign_to', PhabricatorTransactions::TYPE_SUBSCRIBERS => 'ccs', ManiphestTransaction::TYPE_PRIORITY => 'priority', - ManiphestTransaction::TYPE_PROJECTS => 'projects', + PhabricatorTransactions::TYPE_EDGE => 'projects', ); $projects_source = new PhabricatorProjectDatasource(); @@ -272,7 +272,7 @@ final class ManiphestTaskDetailController extends ManiphestController { $mailable_source = new PhabricatorMetaMTAMailableDatasource(); $tokenizer_map = array( - ManiphestTransaction::TYPE_PROJECTS => array( + PhabricatorTransactions::TYPE_EDGE => array( 'id' => 'projects-tokenizer', 'src' => $projects_source->getDatasourceURI(), 'placeholder' => $projects_source->getPlaceholderText(), diff --git a/src/applications/maniphest/controller/ManiphestTaskEditController.php b/src/applications/maniphest/controller/ManiphestTaskEditController.php index 5d91917d4e..cfd121e59b 100644 --- a/src/applications/maniphest/controller/ManiphestTaskEditController.php +++ b/src/applications/maniphest/controller/ManiphestTaskEditController.php @@ -234,7 +234,7 @@ final class ManiphestTaskEditController extends ManiphestController { if ($can_edit_projects) { $projects = $request->getArr('projects'); - $changes[ManiphestTransaction::TYPE_PROJECTS] = + $changes[PhabricatorTransactions::TYPE_EDGE] = $projects; $column_phid = $request->getStr('columnPHID'); // allow for putting a task in a project column at creation -only- @@ -276,12 +276,10 @@ final class ManiphestTaskEditController extends ManiphestController { if ($type == ManiphestTransaction::TYPE_PROJECT_COLUMN) { $transaction->setNewValue($value['new']); $transaction->setOldValue($value['old']); - } else if ($type == ManiphestTransaction::TYPE_PROJECTS) { - // TODO: Gross. + } else if ($type == PhabricatorTransactions::TYPE_EDGE) { $project_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST; $transaction - ->setTransactionType(PhabricatorTransactions::TYPE_EDGE) ->setMetadataValue('edge:type', $project_type) ->setNewValue( array( diff --git a/src/applications/maniphest/controller/ManiphestTransactionPreviewController.php b/src/applications/maniphest/controller/ManiphestTransactionPreviewController.php index 6f1d4f4787..25f78c00df 100644 --- a/src/applications/maniphest/controller/ManiphestTransactionPreviewController.php +++ b/src/applications/maniphest/controller/ManiphestTransactionPreviewController.php @@ -72,7 +72,7 @@ final class ManiphestTransactionPreviewController extends ManiphestController { $transaction->setOldValue(array()); $transaction->setNewValue($phids); break; - case ManiphestTransaction::TYPE_PROJECTS: + case PhabricatorTransactions::TYPE_EDGE: if ($value) { $value = json_decode($value); } diff --git a/src/applications/maniphest/controller/ManiphestTransactionSaveController.php b/src/applications/maniphest/controller/ManiphestTransactionSaveController.php index cc5be68982..6f6e60df27 100644 --- a/src/applications/maniphest/controller/ManiphestTransactionSaveController.php +++ b/src/applications/maniphest/controller/ManiphestTransactionSaveController.php @@ -50,16 +50,14 @@ final class ManiphestTransactionSaveController extends ManiphestController { $assign_to = reset($assign_to); $transaction->setNewValue($assign_to); break; - case ManiphestTransaction::TYPE_PROJECTS: + case PhabricatorTransactions::TYPE_EDGE: $projects = $request->getArr('projects'); $projects = array_merge($projects, $task->getProjectPHIDs()); $projects = array_filter($projects); $projects = array_unique($projects); - // TODO: Bleh. $project_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST; $transaction - ->setTransactionType(PhabricatorTransactions::TYPE_EDGE) ->setMetadataValue('edge:type', $project_type) ->setNewValue( array( diff --git a/src/applications/project/edge/PhabricatorProjectObjectHasProjectEdgeType.php b/src/applications/project/edge/PhabricatorProjectObjectHasProjectEdgeType.php index 789a3cbba5..eae9a72c90 100644 --- a/src/applications/project/edge/PhabricatorProjectObjectHasProjectEdgeType.php +++ b/src/applications/project/edge/PhabricatorProjectObjectHasProjectEdgeType.php @@ -9,6 +9,12 @@ final class PhabricatorProjectObjectHasProjectEdgeType return PhabricatorProjectProjectHasObjectEdgeType::EDGECONST; } + public function getTransactionPreviewString($actor) { + return pht( + '%s edited associated projects.', + $actor); + } + public function getTransactionAddString( $actor, $add_count, diff --git a/src/applications/transactions/storage/PhabricatorApplicationTransaction.php b/src/applications/transactions/storage/PhabricatorApplicationTransaction.php index 570c67af7f..016b01f1a9 100644 --- a/src/applications/transactions/storage/PhabricatorApplicationTransaction.php +++ b/src/applications/transactions/storage/PhabricatorApplicationTransaction.php @@ -667,8 +667,7 @@ abstract class PhabricatorApplicationTransaction new PhutilNumber(count($rem)), $this->renderHandleList($rem)); } else { - return pht( - '%s edited edge metadata.', + return $type_obj->getTransactionPreviewString( $this->renderHandleLink($author_phid)); } diff --git a/src/infrastructure/edges/type/PhabricatorEdgeType.php b/src/infrastructure/edges/type/PhabricatorEdgeType.php index 6c2f28e584..29352b0dea 100644 --- a/src/infrastructure/edges/type/PhabricatorEdgeType.php +++ b/src/infrastructure/edges/type/PhabricatorEdgeType.php @@ -46,6 +46,12 @@ abstract class PhabricatorEdgeType extends Phobject { return false; } + public function getTransactionPreviewString($actor) { + return pht( + '%s edited edge metadata.', + $actor); + } + public function getTransactionAddString( $actor, $add_count,