From bb4bf01bdcd2d67009f9a84e5d52537aec609b66 Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 25 Sep 2013 11:16:43 -0700 Subject: [PATCH] Remove ManiphestTransactionType Summary: These constants have moved to ManiphestTransaction. The other method only has one plausible callsite, just inline it. Test Plan: Used Maniphest. Reviewers: btrahan Reviewed By: btrahan CC: aran Differential Revision: https://secure.phabricator.com/D7113 --- src/__phutil_library_map__.php | 2 -- .../conduit/ConduitAPI_maniphest_Method.php | 18 +++++----- .../maniphest/constants/ManiphestAction.php | 16 ++++----- .../constants/ManiphestTransactionType.php | 32 ----------------- .../ManiphestBatchEditController.php | 34 +++++++++--------- .../controller/ManiphestReportController.php | 2 +- .../ManiphestTaskDetailController.php | 35 ++++++++++++------- .../ManiphestTaskEditController.php | 18 +++++----- .../ManiphestTransactionPreviewController.php | 8 ++--- .../ManiphestTransactionSaveController.php | 26 +++++++------- .../event/ManiphestEdgeEventListener.php | 2 +- ...bricatorManiphestTaskTestDataGenerator.php | 14 ++++---- .../maniphest/mail/ManiphestReplyHandler.php | 10 +++--- .../PhabricatorSearchAttachController.php | 4 +-- 14 files changed, 98 insertions(+), 123 deletions(-) delete mode 100644 src/applications/maniphest/constants/ManiphestTransactionType.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index ea9c7b67c2..b0ee9eb258 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -737,7 +737,6 @@ phutil_register_library_map(array( 'ManiphestTransactionPreviewController' => 'applications/maniphest/controller/ManiphestTransactionPreviewController.php', 'ManiphestTransactionQuery' => 'applications/maniphest/query/ManiphestTransactionQuery.php', 'ManiphestTransactionSaveController' => 'applications/maniphest/controller/ManiphestTransactionSaveController.php', - 'ManiphestTransactionType' => 'applications/maniphest/constants/ManiphestTransactionType.php', 'ManiphestView' => 'applications/maniphest/view/ManiphestView.php', 'MetaMTAConstants' => 'applications/metamta/constants/MetaMTAConstants.php', 'MetaMTANotificationType' => 'applications/metamta/constants/MetaMTANotificationType.php', @@ -2829,7 +2828,6 @@ phutil_register_library_map(array( 'ManiphestTransactionPreviewController' => 'ManiphestController', 'ManiphestTransactionQuery' => 'PhabricatorApplicationTransactionQuery', 'ManiphestTransactionSaveController' => 'ManiphestController', - 'ManiphestTransactionType' => 'ManiphestConstants', 'ManiphestView' => 'AphrontView', 'MetaMTANotificationType' => 'MetaMTAConstants', 'MetaMTAReceivedMailStatus' => 'MetaMTAConstants', diff --git a/src/applications/maniphest/conduit/ConduitAPI_maniphest_Method.php b/src/applications/maniphest/conduit/ConduitAPI_maniphest_Method.php index fe845b9957..da831f1415 100644 --- a/src/applications/maniphest/conduit/ConduitAPI_maniphest_Method.php +++ b/src/applications/maniphest/conduit/ConduitAPI_maniphest_Method.php @@ -62,7 +62,7 @@ abstract class ConduitAPI_maniphest_Method extends ConduitAPIMethod { if ($is_new) { $task->setTitle((string)$request->getValue('title')); $task->setDescription((string)$request->getValue('description')); - $changes[ManiphestTransactionType::TYPE_STATUS] = + $changes[ManiphestTransaction::TYPE_STATUS] = ManiphestTaskStatus::STATUS_OPEN; } else { @@ -73,12 +73,12 @@ abstract class ConduitAPI_maniphest_Method extends ConduitAPIMethod { $title = $request->getValue('title'); if ($title !== null) { - $changes[ManiphestTransactionType::TYPE_TITLE] = $title; + $changes[ManiphestTransaction::TYPE_TITLE] = $title; } $desc = $request->getValue('description'); if ($desc !== null) { - $changes[ManiphestTransactionType::TYPE_DESCRIPTION] = $desc; + $changes[ManiphestTransaction::TYPE_DESCRIPTION] = $desc; } $status = $request->getValue('status'); @@ -88,7 +88,7 @@ abstract class ConduitAPI_maniphest_Method extends ConduitAPIMethod { throw id(new ConduitException('ERR-INVALID-PARAMETER')) ->setErrorDescription('Status set to invalid value.'); } - $changes[ManiphestTransactionType::TYPE_STATUS] = $status; + $changes[ManiphestTransaction::TYPE_STATUS] = $status; } } @@ -99,7 +99,7 @@ abstract class ConduitAPI_maniphest_Method extends ConduitAPIMethod { throw id(new ConduitException('ERR-INVALID-PARAMETER')) ->setErrorDescription('Priority set to invalid value.'); } - $changes[ManiphestTransactionType::TYPE_PRIORITY] = $priority; + $changes[ManiphestTransaction::TYPE_PRIORITY] = $priority; } $owner_phid = $request->getValue('ownerPHID'); @@ -107,7 +107,7 @@ abstract class ConduitAPI_maniphest_Method extends ConduitAPIMethod { $this->validatePHIDList(array($owner_phid), PhabricatorPeoplePHIDTypeUser::TYPECONST, 'ownerPHID'); - $changes[ManiphestTransactionType::TYPE_OWNER] = $owner_phid; + $changes[ManiphestTransaction::TYPE_OWNER] = $owner_phid; } $ccs = $request->getValue('ccPHIDs'); @@ -115,7 +115,7 @@ abstract class ConduitAPI_maniphest_Method extends ConduitAPIMethod { $this->validatePHIDList($ccs, PhabricatorPeoplePHIDTypeUser::TYPECONST, 'ccPHIDS'); - $changes[ManiphestTransactionType::TYPE_CCS] = $ccs; + $changes[ManiphestTransaction::TYPE_CCS] = $ccs; } $project_phids = $request->getValue('projectPHIDs'); @@ -123,7 +123,7 @@ abstract class ConduitAPI_maniphest_Method extends ConduitAPIMethod { $this->validatePHIDList($project_phids, PhabricatorProjectPHIDTypeProject::TYPECONST, 'projectPHIDS'); - $changes[ManiphestTransactionType::TYPE_PROJECTS] = $project_phids; + $changes[ManiphestTransaction::TYPE_PROJECTS] = $project_phids; } $file_phids = $request->getValue('filePHIDs'); @@ -135,7 +135,7 @@ abstract class ConduitAPI_maniphest_Method extends ConduitAPIMethod { $attached = $task->getAttached(); $attached[PhabricatorFilePHIDTypeFile::TYPECONST] = $file_map; - $changes[ManiphestTransactionType::TYPE_ATTACH] = $attached; + $changes[ManiphestTransaction::TYPE_ATTACH] = $attached; } $template = new ManiphestTransaction(); diff --git a/src/applications/maniphest/constants/ManiphestAction.php b/src/applications/maniphest/constants/ManiphestAction.php index 9eedc8bb68..f45a47088a 100644 --- a/src/applications/maniphest/constants/ManiphestAction.php +++ b/src/applications/maniphest/constants/ManiphestAction.php @@ -15,14 +15,14 @@ final class ManiphestAction extends ManiphestConstants { /* these actions are determined sufficiently by the transaction type and thus we use them here*/ const ACTION_COMMENT = PhabricatorTransactions::TYPE_COMMENT; - const ACTION_CC = ManiphestTransactionType::TYPE_CCS; - const ACTION_PRIORITY = ManiphestTransactionType::TYPE_PRIORITY; - const ACTION_PROJECT = ManiphestTransactionType::TYPE_PROJECTS; - const ACTION_TITLE = ManiphestTransactionType::TYPE_TITLE; - const ACTION_DESCRIPTION = ManiphestTransactionType::TYPE_DESCRIPTION; - const ACTION_REASSIGN = ManiphestTransactionType::TYPE_OWNER; - const ACTION_ATTACH = ManiphestTransactionType::TYPE_ATTACH; - const ACTION_EDGE = ManiphestTransactionType::TYPE_EDGE; + const ACTION_CC = ManiphestTransaction::TYPE_CCS; + const ACTION_PRIORITY = ManiphestTransaction::TYPE_PRIORITY; + const ACTION_PROJECT = ManiphestTransaction::TYPE_PROJECTS; + const ACTION_TITLE = ManiphestTransaction::TYPE_TITLE; + const ACTION_DESCRIPTION = ManiphestTransaction::TYPE_DESCRIPTION; + const ACTION_REASSIGN = ManiphestTransaction::TYPE_OWNER; + const ACTION_ATTACH = ManiphestTransaction::TYPE_ATTACH; + const ACTION_EDGE = ManiphestTransaction::TYPE_EDGE; const ACTION_AUXILIARY = PhabricatorTransactions::TYPE_CUSTOMFIELD; public static function getActionPastTenseVerb($action) { diff --git a/src/applications/maniphest/constants/ManiphestTransactionType.php b/src/applications/maniphest/constants/ManiphestTransactionType.php deleted file mode 100644 index 724aec5ea0..0000000000 --- a/src/applications/maniphest/constants/ManiphestTransactionType.php +++ /dev/null @@ -1,32 +0,0 @@ - pht('Comment'), - self::TYPE_STATUS => pht('Close Task'), - self::TYPE_OWNER => pht('Reassign / Claim'), - self::TYPE_CCS => pht('Add CCs'), - self::TYPE_PRIORITY => pht('Change Priority'), - self::TYPE_ATTACH => pht('Upload File'), - self::TYPE_PROJECTS => pht('Associate Projects'), - ); - } - -} diff --git a/src/applications/maniphest/controller/ManiphestBatchEditController.php b/src/applications/maniphest/controller/ManiphestBatchEditController.php index 3686e9c621..5a6e7e48cc 100644 --- a/src/applications/maniphest/controller/ManiphestBatchEditController.php +++ b/src/applications/maniphest/controller/ManiphestBatchEditController.php @@ -158,13 +158,13 @@ final class ManiphestBatchEditController extends ManiphestController { $value_map = array(); $type_map = array( 'add_comment' => PhabricatorTransactions::TYPE_COMMENT, - 'assign' => ManiphestTransactionType::TYPE_OWNER, - 'status' => ManiphestTransactionType::TYPE_STATUS, - 'priority' => ManiphestTransactionType::TYPE_PRIORITY, - 'add_project' => ManiphestTransactionType::TYPE_PROJECTS, - 'remove_project' => ManiphestTransactionType::TYPE_PROJECTS, - 'add_ccs' => ManiphestTransactionType::TYPE_CCS, - 'remove_ccs' => ManiphestTransactionType::TYPE_CCS, + 'assign' => ManiphestTransaction::TYPE_OWNER, + 'status' => ManiphestTransaction::TYPE_STATUS, + 'priority' => ManiphestTransaction::TYPE_PRIORITY, + 'add_project' => ManiphestTransaction::TYPE_PROJECTS, + 'remove_project' => ManiphestTransaction::TYPE_PROJECTS, + 'add_ccs' => ManiphestTransaction::TYPE_CCS, + 'remove_ccs' => ManiphestTransaction::TYPE_CCS, ); $edge_edit_types = array( @@ -195,19 +195,19 @@ final class ManiphestBatchEditController extends ManiphestController { case PhabricatorTransactions::TYPE_COMMENT: $current = null; break; - case ManiphestTransactionType::TYPE_OWNER: + case ManiphestTransaction::TYPE_OWNER: $current = $task->getOwnerPHID(); break; - case ManiphestTransactionType::TYPE_STATUS: + case ManiphestTransaction::TYPE_STATUS: $current = $task->getStatus(); break; - case ManiphestTransactionType::TYPE_PRIORITY: + case ManiphestTransaction::TYPE_PRIORITY: $current = $task->getPriority(); break; - case ManiphestTransactionType::TYPE_PROJECTS: + case ManiphestTransaction::TYPE_PROJECTS: $current = $task->getProjectPHIDs(); break; - case ManiphestTransactionType::TYPE_CCS: + case ManiphestTransaction::TYPE_CCS: $current = $task->getCCPHIDs(); break; } @@ -224,7 +224,7 @@ final class ManiphestBatchEditController extends ManiphestController { continue 2; } break; - case ManiphestTransactionType::TYPE_OWNER: + case ManiphestTransaction::TYPE_OWNER: if (empty($value)) { continue 2; } @@ -233,12 +233,12 @@ final class ManiphestBatchEditController extends ManiphestController { $value = null; } break; - case ManiphestTransactionType::TYPE_PROJECTS: + case ManiphestTransaction::TYPE_PROJECTS: if (empty($value)) { continue 2; } break; - case ManiphestTransactionType::TYPE_CCS: + case ManiphestTransaction::TYPE_CCS: if (empty($value)) { continue 2; } @@ -265,8 +265,8 @@ final class ManiphestBatchEditController extends ManiphestController { $value = $current."\n\n".$value; } break; - case ManiphestTransactionType::TYPE_PROJECTS: - case ManiphestTransactionType::TYPE_CCS: + case ManiphestTransaction::TYPE_PROJECTS: + case ManiphestTransaction::TYPE_CCS: $remove_actions = array( 'remove_project' => true, 'remove_ccs' => true, diff --git a/src/applications/maniphest/controller/ManiphestReportController.php b/src/applications/maniphest/controller/ManiphestReportController.php index 95956b610f..a86173c6a3 100644 --- a/src/applications/maniphest/controller/ManiphestReportController.php +++ b/src/applications/maniphest/controller/ManiphestReportController.php @@ -100,7 +100,7 @@ final class ManiphestReportController extends ManiphestController { ORDER BY x.dateCreated ASC', $table->getTableName(), $joins, - ManiphestTransactionType::TYPE_STATUS); + ManiphestTransaction::TYPE_STATUS); $stats = array(); $day_buckets = array(); diff --git a/src/applications/maniphest/controller/ManiphestTaskDetailController.php b/src/applications/maniphest/controller/ManiphestTaskDetailController.php index 54923a22fe..e3909df011 100644 --- a/src/applications/maniphest/controller/ManiphestTaskDetailController.php +++ b/src/applications/maniphest/controller/ManiphestTaskDetailController.php @@ -146,9 +146,18 @@ final class ManiphestTaskDetailController extends ManiphestController { $engine->process(); - $transaction_types = ManiphestTransactionType::getTransactionTypeMap(); $resolution_types = ManiphestTaskStatus::getTaskStatusMap(); + $transaction_types = array( + PhabricatorTransactions::TYPE_COMMENT => pht('Comment'), + ManiphestTransaction::TYPE_STATUS => pht('Close Task'), + ManiphestTransaction::TYPE_OWNER => pht('Reassign / Claim'), + ManiphestTransaction::TYPE_CCS => pht('Add CCs'), + ManiphestTransaction::TYPE_PRIORITY => pht('Change Priority'), + ManiphestTransaction::TYPE_ATTACH => pht('Upload File'), + ManiphestTransaction::TYPE_PROJECTS => pht('Associate Projects'), + ); + if ($task->getStatus() == ManiphestTaskStatus::STATUS_OPEN) { $resolution_types = array_select_keys( $resolution_types, @@ -162,10 +171,10 @@ final class ManiphestTaskDetailController extends ManiphestController { $resolution_types = array( ManiphestTaskStatus::STATUS_OPEN => 'Reopened', ); - $transaction_types[ManiphestTransactionType::TYPE_STATUS] = + $transaction_types[ManiphestTransaction::TYPE_STATUS] = 'Reopen Task'; - unset($transaction_types[ManiphestTransactionType::TYPE_PRIORITY]); - unset($transaction_types[ManiphestTransactionType::TYPE_OWNER]); + unset($transaction_types[ManiphestTransaction::TYPE_PRIORITY]); + unset($transaction_types[ManiphestTransaction::TYPE_OWNER]); } $default_claim = array( @@ -260,22 +269,22 @@ final class ManiphestTaskDetailController extends ManiphestController { ->setValue($is_serious ? pht('Submit') : pht('Avast!'))); $control_map = array( - ManiphestTransactionType::TYPE_STATUS => 'resolution', - ManiphestTransactionType::TYPE_OWNER => 'assign_to', - ManiphestTransactionType::TYPE_CCS => 'ccs', - ManiphestTransactionType::TYPE_PRIORITY => 'priority', - ManiphestTransactionType::TYPE_PROJECTS => 'projects', - ManiphestTransactionType::TYPE_ATTACH => 'file', + ManiphestTransaction::TYPE_STATUS => 'resolution', + ManiphestTransaction::TYPE_OWNER => 'assign_to', + ManiphestTransaction::TYPE_CCS => 'ccs', + ManiphestTransaction::TYPE_PRIORITY => 'priority', + ManiphestTransaction::TYPE_PROJECTS => 'projects', + ManiphestTransaction::TYPE_ATTACH => 'file', ); $tokenizer_map = array( - ManiphestTransactionType::TYPE_PROJECTS => array( + ManiphestTransaction::TYPE_PROJECTS => array( 'id' => 'projects-tokenizer', 'src' => '/typeahead/common/projects/', 'ondemand' => PhabricatorEnv::getEnvConfig('tokenizer.ondemand'), 'placeholder' => pht('Type a project name...'), ), - ManiphestTransactionType::TYPE_OWNER => array( + ManiphestTransaction::TYPE_OWNER => array( 'id' => 'assign-tokenizer', 'src' => '/typeahead/common/users/', 'value' => $default_claim, @@ -283,7 +292,7 @@ final class ManiphestTaskDetailController extends ManiphestController { 'ondemand' => PhabricatorEnv::getEnvConfig('tokenizer.ondemand'), 'placeholder' => pht('Type a user name...'), ), - ManiphestTransactionType::TYPE_CCS => array( + ManiphestTransaction::TYPE_CCS => array( 'id' => 'cc-tokenizer', 'src' => '/typeahead/common/mailable/', 'ondemand' => PhabricatorEnv::getEnvConfig('tokenizer.ondemand'), diff --git a/src/applications/maniphest/controller/ManiphestTaskEditController.php b/src/applications/maniphest/controller/ManiphestTaskEditController.php index a78f0a64e1..8d2af82b53 100644 --- a/src/applications/maniphest/controller/ManiphestTaskEditController.php +++ b/src/applications/maniphest/controller/ManiphestTaskEditController.php @@ -108,18 +108,18 @@ final class ManiphestTaskEditController extends ManiphestController { if ($task->getID()) { if ($new_title != $task->getTitle()) { - $changes[ManiphestTransactionType::TYPE_TITLE] = $new_title; + $changes[ManiphestTransaction::TYPE_TITLE] = $new_title; } if ($new_desc != $task->getDescription()) { - $changes[ManiphestTransactionType::TYPE_DESCRIPTION] = $new_desc; + $changes[ManiphestTransaction::TYPE_DESCRIPTION] = $new_desc; } if ($new_status != $task->getStatus()) { - $changes[ManiphestTransactionType::TYPE_STATUS] = $new_status; + $changes[ManiphestTransaction::TYPE_STATUS] = $new_status; } } else { $task->setTitle($new_title); $task->setDescription($new_desc); - $changes[ManiphestTransactionType::TYPE_STATUS] = + $changes[ManiphestTransaction::TYPE_STATUS] = ManiphestTaskStatus::STATUS_OPEN; $workflow = 'create'; @@ -172,16 +172,16 @@ final class ManiphestTaskEditController extends ManiphestController { $task->setProjectPHIDs($request->getArr('projects')); } else { if ($request->getInt('priority') != $task->getPriority()) { - $changes[ManiphestTransactionType::TYPE_PRIORITY] = + $changes[ManiphestTransaction::TYPE_PRIORITY] = $request->getInt('priority'); } if ($owner_phid != $task->getOwnerPHID()) { - $changes[ManiphestTransactionType::TYPE_OWNER] = $owner_phid; + $changes[ManiphestTransaction::TYPE_OWNER] = $owner_phid; } if ($request->getArr('cc') != $task->getCCPHIDs()) { - $changes[ManiphestTransactionType::TYPE_CCS] = $request->getArr('cc'); + $changes[ManiphestTransaction::TYPE_CCS] = $request->getArr('cc'); } $new_proj_arr = $request->getArr('projects'); @@ -193,13 +193,13 @@ final class ManiphestTaskEditController extends ManiphestController { sort($cur_proj_arr); if ($new_proj_arr != $cur_proj_arr) { - $changes[ManiphestTransactionType::TYPE_PROJECTS] = $new_proj_arr; + $changes[ManiphestTransaction::TYPE_PROJECTS] = $new_proj_arr; } if ($files) { $file_map = mpull($files, 'getPHID'); $file_map = array_fill_keys($file_map, array()); - $changes[ManiphestTransactionType::TYPE_ATTACH] = array( + $changes[ManiphestTransaction::TYPE_ATTACH] = array( PhabricatorFilePHIDTypeFile::TYPECONST => $file_map, ); } diff --git a/src/applications/maniphest/controller/ManiphestTransactionPreviewController.php b/src/applications/maniphest/controller/ManiphestTransactionPreviewController.php index 39c623d2de..d5aad01980 100644 --- a/src/applications/maniphest/controller/ManiphestTransactionPreviewController.php +++ b/src/applications/maniphest/controller/ManiphestTransactionPreviewController.php @@ -45,11 +45,11 @@ final class ManiphestTransactionPreviewController extends ManiphestController { // grab phids for handles and set transaction values based on action and // value (empty or control-specific format) coming in from the wire switch ($action) { - case ManiphestTransactionType::TYPE_PRIORITY: + case ManiphestTransaction::TYPE_PRIORITY: $transaction->setOldValue($task->getPriority()); $transaction->setNewValue($value); break; - case ManiphestTransactionType::TYPE_OWNER: + case ManiphestTransaction::TYPE_OWNER: if ($value) { $value = current(json_decode($value)); $phids = array($value); @@ -58,7 +58,7 @@ final class ManiphestTransactionPreviewController extends ManiphestController { } $transaction->setNewValue($value); break; - case ManiphestTransactionType::TYPE_CCS: + case ManiphestTransaction::TYPE_CCS: if ($value) { $value = json_decode($value); } @@ -75,7 +75,7 @@ final class ManiphestTransactionPreviewController extends ManiphestController { $transaction->setOldValue($task->getCCPHIDs()); $transaction->setNewValue($value); break; - case ManiphestTransactionType::TYPE_PROJECTS: + case ManiphestTransaction::TYPE_PROJECTS: if ($value) { $value = json_decode($value); } diff --git a/src/applications/maniphest/controller/ManiphestTransactionSaveController.php b/src/applications/maniphest/controller/ManiphestTransactionSaveController.php index 92c62e5e0b..d2a52fcdf2 100644 --- a/src/applications/maniphest/controller/ManiphestTransactionSaveController.php +++ b/src/applications/maniphest/controller/ManiphestTransactionSaveController.php @@ -33,7 +33,7 @@ final class ManiphestTransactionSaveController extends ManiphestController { // This means "attach a file" even though we store other types of data // as 'attached'. - if ($action == ManiphestTransactionType::TYPE_ATTACH) { + if ($action == ManiphestTransaction::TYPE_ATTACH) { if (!empty($_FILES['file'])) { $err = idx($_FILES['file'], 'error'); if ($err != UPLOAD_ERR_NO_FILE) { @@ -61,7 +61,7 @@ final class ManiphestTransactionSaveController extends ManiphestController { } $transaction = new ManiphestTransaction(); $transaction - ->setTransactionType(ManiphestTransactionType::TYPE_ATTACH); + ->setTransactionType(ManiphestTransaction::TYPE_ATTACH); $transaction->setNewValue($new); $transactions[] = $transaction; } @@ -78,29 +78,29 @@ final class ManiphestTransactionSaveController extends ManiphestController { $cc_transaction = new ManiphestTransaction(); $cc_transaction - ->setTransactionType(ManiphestTransactionType::TYPE_CCS); + ->setTransactionType(ManiphestTransaction::TYPE_CCS); $transaction = new ManiphestTransaction(); $transaction ->setTransactionType($action); switch ($action) { - case ManiphestTransactionType::TYPE_STATUS: + case ManiphestTransaction::TYPE_STATUS: $transaction->setNewValue($request->getStr('resolution')); break; - case ManiphestTransactionType::TYPE_OWNER: + case ManiphestTransaction::TYPE_OWNER: $assign_to = $request->getArr('assign_to'); $assign_to = reset($assign_to); $transaction->setNewValue($assign_to); break; - case ManiphestTransactionType::TYPE_PROJECTS: + case ManiphestTransaction::TYPE_PROJECTS: $projects = $request->getArr('projects'); $projects = array_merge($projects, $task->getProjectPHIDs()); $projects = array_filter($projects); $projects = array_unique($projects); $transaction->setNewValue($projects); break; - case ManiphestTransactionType::TYPE_CCS: + case ManiphestTransaction::TYPE_CCS: // Accumulate the new explicit CCs into the array that we'll add in // the CC transaction later. $added_ccs = array_merge($added_ccs, $request->getArr('ccs')); @@ -108,10 +108,10 @@ final class ManiphestTransactionSaveController extends ManiphestController { // Throw away the primary transaction. $transaction = null; break; - case ManiphestTransactionType::TYPE_PRIORITY: + case ManiphestTransaction::TYPE_PRIORITY: $transaction->setNewValue($request->getInt('priority')); break; - case ManiphestTransactionType::TYPE_ATTACH: + case ManiphestTransaction::TYPE_ATTACH: // Nuke this, we created it above. $transaction = null; break; @@ -143,7 +143,7 @@ final class ManiphestTransactionSaveController extends ManiphestController { $implicitly_claimed = false; switch ($action) { - case ManiphestTransactionType::TYPE_OWNER: + case ManiphestTransaction::TYPE_OWNER: if ($task->getOwnerPHID() == $transaction->getNewValue()) { // If this is actually no-op, don't generate the side effect. break; @@ -151,14 +151,14 @@ final class ManiphestTransactionSaveController extends ManiphestController { // Otherwise, when a task is reassigned, move the previous owner to CC. $added_ccs[] = $task->getOwnerPHID(); break; - case ManiphestTransactionType::TYPE_STATUS: + case ManiphestTransaction::TYPE_STATUS: if (!$task->getOwnerPHID() && $request->getStr('resolution') != ManiphestTaskStatus::STATUS_OPEN) { // Closing an unassigned task. Assign the user as the owner of // this task. $assign = new ManiphestTransaction(); - $assign->setTransactionType(ManiphestTransactionType::TYPE_OWNER); + $assign->setTransactionType(ManiphestTransaction::TYPE_OWNER); $assign->setNewValue($user->getPHID()); $transactions[] = $assign; @@ -172,7 +172,7 @@ final class ManiphestTransactionSaveController extends ManiphestController { if ($implicitly_claimed) { $user_owns_task = true; } else { - if ($action == ManiphestTransactionType::TYPE_OWNER) { + if ($action == ManiphestTransaction::TYPE_OWNER) { if ($transaction->getNewValue() == $user->getPHID()) { $user_owns_task = true; } diff --git a/src/applications/maniphest/event/ManiphestEdgeEventListener.php b/src/applications/maniphest/event/ManiphestEdgeEventListener.php index dd9cacba96..adf87f2e46 100644 --- a/src/applications/maniphest/event/ManiphestEdgeEventListener.php +++ b/src/applications/maniphest/event/ManiphestEdgeEventListener.php @@ -82,7 +82,7 @@ final class ManiphestEdgeEventListener extends PhutilEventListener { } $xactions[] = id(new ManiphestTransaction()) - ->setTransactionType(ManiphestTransactionType::TYPE_EDGE) + ->setTransactionType(ManiphestTransaction::TYPE_EDGE) ->setOldValue($old_type) ->setNewValue($new_type) ->setMetadataValue('edge:type', $type); diff --git a/src/applications/maniphest/lipsum/PhabricatorManiphestTaskTestDataGenerator.php b/src/applications/maniphest/lipsum/PhabricatorManiphestTaskTestDataGenerator.php index 74acea953c..1d07ffbd4c 100644 --- a/src/applications/maniphest/lipsum/PhabricatorManiphestTaskTestDataGenerator.php +++ b/src/applications/maniphest/lipsum/PhabricatorManiphestTaskTestDataGenerator.php @@ -20,19 +20,19 @@ final class PhabricatorManiphestTaskTestDataGenerator $template = new ManiphestTransaction(); // Accumulate Transactions $changes = array(); - $changes[ManiphestTransactionType::TYPE_TITLE] = + $changes[ManiphestTransaction::TYPE_TITLE] = $this->generateTitle(); - $changes[ManiphestTransactionType::TYPE_DESCRIPTION] = + $changes[ManiphestTransaction::TYPE_DESCRIPTION] = $this->generateDescription(); - $changes[ManiphestTransactionType::TYPE_OWNER] = + $changes[ManiphestTransaction::TYPE_OWNER] = $this->loadOwnerPHID(); - $changes[ManiphestTransactionType::TYPE_STATUS] = + $changes[ManiphestTransaction::TYPE_STATUS] = $this->generateTaskStatus(); - $changes[ManiphestTransactionType::TYPE_PRIORITY] = + $changes[ManiphestTransaction::TYPE_PRIORITY] = $this->generateTaskPriority(); - $changes[ManiphestTransactionType::TYPE_CCS] = + $changes[ManiphestTransaction::TYPE_CCS] = $this->getCCPHIDs(); - $changes[ManiphestTransactionType::TYPE_PROJECTS] = + $changes[ManiphestTransaction::TYPE_PROJECTS] = $this->getProjectPHIDs(); $transactions = array(); foreach ($changes as $type => $value) { diff --git a/src/applications/maniphest/mail/ManiphestReplyHandler.php b/src/applications/maniphest/mail/ManiphestReplyHandler.php index d12dd8c234..5f9b90d360 100644 --- a/src/applications/maniphest/mail/ManiphestReplyHandler.php +++ b/src/applications/maniphest/mail/ManiphestReplyHandler.php @@ -63,7 +63,7 @@ final class ManiphestReplyHandler extends PhabricatorMailReplyHandler { // If this is a new task, create a "User created this task." transaction // and then set the title and description. $xaction = clone $template; - $xaction->setTransactionType(ManiphestTransactionType::TYPE_STATUS); + $xaction->setTransactionType(ManiphestTransaction::TYPE_STATUS); $xaction->setNewValue(ManiphestTaskStatus::STATUS_OPEN); $xactions[] = $xaction; @@ -90,16 +90,16 @@ final class ManiphestReplyHandler extends PhabricatorMailReplyHandler { $new_value = null; switch ($command) { case 'close': - $ttype = ManiphestTransactionType::TYPE_STATUS; + $ttype = ManiphestTransaction::TYPE_STATUS; $new_value = ManiphestTaskStatus::STATUS_CLOSED_RESOLVED; break; case 'claim': - $ttype = ManiphestTransactionType::TYPE_OWNER; + $ttype = ManiphestTransaction::TYPE_OWNER; $new_value = $user->getPHID(); break; case 'unsubscribe': $is_unsub = true; - $ttype = ManiphestTransactionType::TYPE_CCS; + $ttype = ManiphestTransaction::TYPE_CCS; $ccs = $task->getCCPHIDs(); foreach ($ccs as $k => $phid) { if ($phid == $user->getPHID()) { @@ -138,7 +138,7 @@ final class ManiphestReplyHandler extends PhabricatorMailReplyHandler { if (array_diff($new_ccs, $old_ccs)) { $cc_xaction = clone $template; - $cc_xaction->setTransactionType(ManiphestTransactionType::TYPE_CCS); + $cc_xaction->setTransactionType(ManiphestTransaction::TYPE_CCS); $cc_xaction->setNewValue($new_ccs); $xactions[] = $cc_xaction; } diff --git a/src/applications/search/controller/PhabricatorSearchAttachController.php b/src/applications/search/controller/PhabricatorSearchAttachController.php index 44e8884fe0..a9a93e789b 100644 --- a/src/applications/search/controller/PhabricatorSearchAttachController.php +++ b/src/applications/search/controller/PhabricatorSearchAttachController.php @@ -176,7 +176,7 @@ final class PhabricatorSearchAttachController $target->getOwnerPHID()); $close_task = id(new ManiphestTransaction()) - ->setTransactionType(ManiphestTransactionType::TYPE_STATUS) + ->setTransactionType(ManiphestTransaction::TYPE_STATUS) ->setNewValue(ManiphestTaskStatus::STATUS_CLOSED_DUPLICATE); $merge_comment = id(new ManiphestTransaction()) @@ -201,7 +201,7 @@ final class PhabricatorSearchAttachController $task_names = implode(', ', $task_names); $add_ccs = id(new ManiphestTransaction()) - ->setTransactionType(ManiphestTransactionType::TYPE_CCS) + ->setTransactionType(ManiphestTransaction::TYPE_CCS) ->setNewValue($all_ccs); $merged_comment = id(new ManiphestTransaction())