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
This commit is contained in:
epriestley
2013-09-25 11:16:43 -07:00
parent b16a390509
commit bb4bf01bdc
14 changed files with 98 additions and 123 deletions

View File

@@ -737,7 +737,6 @@ phutil_register_library_map(array(
'ManiphestTransactionPreviewController' => 'applications/maniphest/controller/ManiphestTransactionPreviewController.php', 'ManiphestTransactionPreviewController' => 'applications/maniphest/controller/ManiphestTransactionPreviewController.php',
'ManiphestTransactionQuery' => 'applications/maniphest/query/ManiphestTransactionQuery.php', 'ManiphestTransactionQuery' => 'applications/maniphest/query/ManiphestTransactionQuery.php',
'ManiphestTransactionSaveController' => 'applications/maniphest/controller/ManiphestTransactionSaveController.php', 'ManiphestTransactionSaveController' => 'applications/maniphest/controller/ManiphestTransactionSaveController.php',
'ManiphestTransactionType' => 'applications/maniphest/constants/ManiphestTransactionType.php',
'ManiphestView' => 'applications/maniphest/view/ManiphestView.php', 'ManiphestView' => 'applications/maniphest/view/ManiphestView.php',
'MetaMTAConstants' => 'applications/metamta/constants/MetaMTAConstants.php', 'MetaMTAConstants' => 'applications/metamta/constants/MetaMTAConstants.php',
'MetaMTANotificationType' => 'applications/metamta/constants/MetaMTANotificationType.php', 'MetaMTANotificationType' => 'applications/metamta/constants/MetaMTANotificationType.php',
@@ -2829,7 +2828,6 @@ phutil_register_library_map(array(
'ManiphestTransactionPreviewController' => 'ManiphestController', 'ManiphestTransactionPreviewController' => 'ManiphestController',
'ManiphestTransactionQuery' => 'PhabricatorApplicationTransactionQuery', 'ManiphestTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
'ManiphestTransactionSaveController' => 'ManiphestController', 'ManiphestTransactionSaveController' => 'ManiphestController',
'ManiphestTransactionType' => 'ManiphestConstants',
'ManiphestView' => 'AphrontView', 'ManiphestView' => 'AphrontView',
'MetaMTANotificationType' => 'MetaMTAConstants', 'MetaMTANotificationType' => 'MetaMTAConstants',
'MetaMTAReceivedMailStatus' => 'MetaMTAConstants', 'MetaMTAReceivedMailStatus' => 'MetaMTAConstants',

View File

@@ -62,7 +62,7 @@ abstract class ConduitAPI_maniphest_Method extends ConduitAPIMethod {
if ($is_new) { if ($is_new) {
$task->setTitle((string)$request->getValue('title')); $task->setTitle((string)$request->getValue('title'));
$task->setDescription((string)$request->getValue('description')); $task->setDescription((string)$request->getValue('description'));
$changes[ManiphestTransactionType::TYPE_STATUS] = $changes[ManiphestTransaction::TYPE_STATUS] =
ManiphestTaskStatus::STATUS_OPEN; ManiphestTaskStatus::STATUS_OPEN;
} else { } else {
@@ -73,12 +73,12 @@ abstract class ConduitAPI_maniphest_Method extends ConduitAPIMethod {
$title = $request->getValue('title'); $title = $request->getValue('title');
if ($title !== null) { if ($title !== null) {
$changes[ManiphestTransactionType::TYPE_TITLE] = $title; $changes[ManiphestTransaction::TYPE_TITLE] = $title;
} }
$desc = $request->getValue('description'); $desc = $request->getValue('description');
if ($desc !== null) { if ($desc !== null) {
$changes[ManiphestTransactionType::TYPE_DESCRIPTION] = $desc; $changes[ManiphestTransaction::TYPE_DESCRIPTION] = $desc;
} }
$status = $request->getValue('status'); $status = $request->getValue('status');
@@ -88,7 +88,7 @@ abstract class ConduitAPI_maniphest_Method extends ConduitAPIMethod {
throw id(new ConduitException('ERR-INVALID-PARAMETER')) throw id(new ConduitException('ERR-INVALID-PARAMETER'))
->setErrorDescription('Status set to invalid value.'); ->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')) throw id(new ConduitException('ERR-INVALID-PARAMETER'))
->setErrorDescription('Priority set to invalid value.'); ->setErrorDescription('Priority set to invalid value.');
} }
$changes[ManiphestTransactionType::TYPE_PRIORITY] = $priority; $changes[ManiphestTransaction::TYPE_PRIORITY] = $priority;
} }
$owner_phid = $request->getValue('ownerPHID'); $owner_phid = $request->getValue('ownerPHID');
@@ -107,7 +107,7 @@ abstract class ConduitAPI_maniphest_Method extends ConduitAPIMethod {
$this->validatePHIDList(array($owner_phid), $this->validatePHIDList(array($owner_phid),
PhabricatorPeoplePHIDTypeUser::TYPECONST, PhabricatorPeoplePHIDTypeUser::TYPECONST,
'ownerPHID'); 'ownerPHID');
$changes[ManiphestTransactionType::TYPE_OWNER] = $owner_phid; $changes[ManiphestTransaction::TYPE_OWNER] = $owner_phid;
} }
$ccs = $request->getValue('ccPHIDs'); $ccs = $request->getValue('ccPHIDs');
@@ -115,7 +115,7 @@ abstract class ConduitAPI_maniphest_Method extends ConduitAPIMethod {
$this->validatePHIDList($ccs, $this->validatePHIDList($ccs,
PhabricatorPeoplePHIDTypeUser::TYPECONST, PhabricatorPeoplePHIDTypeUser::TYPECONST,
'ccPHIDS'); 'ccPHIDS');
$changes[ManiphestTransactionType::TYPE_CCS] = $ccs; $changes[ManiphestTransaction::TYPE_CCS] = $ccs;
} }
$project_phids = $request->getValue('projectPHIDs'); $project_phids = $request->getValue('projectPHIDs');
@@ -123,7 +123,7 @@ abstract class ConduitAPI_maniphest_Method extends ConduitAPIMethod {
$this->validatePHIDList($project_phids, $this->validatePHIDList($project_phids,
PhabricatorProjectPHIDTypeProject::TYPECONST, PhabricatorProjectPHIDTypeProject::TYPECONST,
'projectPHIDS'); 'projectPHIDS');
$changes[ManiphestTransactionType::TYPE_PROJECTS] = $project_phids; $changes[ManiphestTransaction::TYPE_PROJECTS] = $project_phids;
} }
$file_phids = $request->getValue('filePHIDs'); $file_phids = $request->getValue('filePHIDs');
@@ -135,7 +135,7 @@ abstract class ConduitAPI_maniphest_Method extends ConduitAPIMethod {
$attached = $task->getAttached(); $attached = $task->getAttached();
$attached[PhabricatorFilePHIDTypeFile::TYPECONST] = $file_map; $attached[PhabricatorFilePHIDTypeFile::TYPECONST] = $file_map;
$changes[ManiphestTransactionType::TYPE_ATTACH] = $attached; $changes[ManiphestTransaction::TYPE_ATTACH] = $attached;
} }
$template = new ManiphestTransaction(); $template = new ManiphestTransaction();

View File

@@ -15,14 +15,14 @@ final class ManiphestAction extends ManiphestConstants {
/* these actions are determined sufficiently by the transaction /* these actions are determined sufficiently by the transaction
type and thus we use them here*/ type and thus we use them here*/
const ACTION_COMMENT = PhabricatorTransactions::TYPE_COMMENT; const ACTION_COMMENT = PhabricatorTransactions::TYPE_COMMENT;
const ACTION_CC = ManiphestTransactionType::TYPE_CCS; const ACTION_CC = ManiphestTransaction::TYPE_CCS;
const ACTION_PRIORITY = ManiphestTransactionType::TYPE_PRIORITY; const ACTION_PRIORITY = ManiphestTransaction::TYPE_PRIORITY;
const ACTION_PROJECT = ManiphestTransactionType::TYPE_PROJECTS; const ACTION_PROJECT = ManiphestTransaction::TYPE_PROJECTS;
const ACTION_TITLE = ManiphestTransactionType::TYPE_TITLE; const ACTION_TITLE = ManiphestTransaction::TYPE_TITLE;
const ACTION_DESCRIPTION = ManiphestTransactionType::TYPE_DESCRIPTION; const ACTION_DESCRIPTION = ManiphestTransaction::TYPE_DESCRIPTION;
const ACTION_REASSIGN = ManiphestTransactionType::TYPE_OWNER; const ACTION_REASSIGN = ManiphestTransaction::TYPE_OWNER;
const ACTION_ATTACH = ManiphestTransactionType::TYPE_ATTACH; const ACTION_ATTACH = ManiphestTransaction::TYPE_ATTACH;
const ACTION_EDGE = ManiphestTransactionType::TYPE_EDGE; const ACTION_EDGE = ManiphestTransaction::TYPE_EDGE;
const ACTION_AUXILIARY = PhabricatorTransactions::TYPE_CUSTOMFIELD; const ACTION_AUXILIARY = PhabricatorTransactions::TYPE_CUSTOMFIELD;
public static function getActionPastTenseVerb($action) { public static function getActionPastTenseVerb($action) {

View File

@@ -1,32 +0,0 @@
<?php
/**
* @group maniphest
*/
final class ManiphestTransactionType extends ManiphestConstants {
const TYPE_STATUS = 'status';
const TYPE_OWNER = 'reassign';
const TYPE_CCS = 'ccs';
const TYPE_PROJECTS = 'projects';
const TYPE_PRIORITY = 'priority';
const TYPE_ATTACH = 'attach';
const TYPE_EDGE = 'edge';
const TYPE_TITLE = 'title';
const TYPE_DESCRIPTION = 'description';
public static function getTransactionTypeMap() {
return array(
PhabricatorTransactions::TYPE_COMMENT => 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'),
);
}
}

View File

@@ -158,13 +158,13 @@ final class ManiphestBatchEditController extends ManiphestController {
$value_map = array(); $value_map = array();
$type_map = array( $type_map = array(
'add_comment' => PhabricatorTransactions::TYPE_COMMENT, 'add_comment' => PhabricatorTransactions::TYPE_COMMENT,
'assign' => ManiphestTransactionType::TYPE_OWNER, 'assign' => ManiphestTransaction::TYPE_OWNER,
'status' => ManiphestTransactionType::TYPE_STATUS, 'status' => ManiphestTransaction::TYPE_STATUS,
'priority' => ManiphestTransactionType::TYPE_PRIORITY, 'priority' => ManiphestTransaction::TYPE_PRIORITY,
'add_project' => ManiphestTransactionType::TYPE_PROJECTS, 'add_project' => ManiphestTransaction::TYPE_PROJECTS,
'remove_project' => ManiphestTransactionType::TYPE_PROJECTS, 'remove_project' => ManiphestTransaction::TYPE_PROJECTS,
'add_ccs' => ManiphestTransactionType::TYPE_CCS, 'add_ccs' => ManiphestTransaction::TYPE_CCS,
'remove_ccs' => ManiphestTransactionType::TYPE_CCS, 'remove_ccs' => ManiphestTransaction::TYPE_CCS,
); );
$edge_edit_types = array( $edge_edit_types = array(
@@ -195,19 +195,19 @@ final class ManiphestBatchEditController extends ManiphestController {
case PhabricatorTransactions::TYPE_COMMENT: case PhabricatorTransactions::TYPE_COMMENT:
$current = null; $current = null;
break; break;
case ManiphestTransactionType::TYPE_OWNER: case ManiphestTransaction::TYPE_OWNER:
$current = $task->getOwnerPHID(); $current = $task->getOwnerPHID();
break; break;
case ManiphestTransactionType::TYPE_STATUS: case ManiphestTransaction::TYPE_STATUS:
$current = $task->getStatus(); $current = $task->getStatus();
break; break;
case ManiphestTransactionType::TYPE_PRIORITY: case ManiphestTransaction::TYPE_PRIORITY:
$current = $task->getPriority(); $current = $task->getPriority();
break; break;
case ManiphestTransactionType::TYPE_PROJECTS: case ManiphestTransaction::TYPE_PROJECTS:
$current = $task->getProjectPHIDs(); $current = $task->getProjectPHIDs();
break; break;
case ManiphestTransactionType::TYPE_CCS: case ManiphestTransaction::TYPE_CCS:
$current = $task->getCCPHIDs(); $current = $task->getCCPHIDs();
break; break;
} }
@@ -224,7 +224,7 @@ final class ManiphestBatchEditController extends ManiphestController {
continue 2; continue 2;
} }
break; break;
case ManiphestTransactionType::TYPE_OWNER: case ManiphestTransaction::TYPE_OWNER:
if (empty($value)) { if (empty($value)) {
continue 2; continue 2;
} }
@@ -233,12 +233,12 @@ final class ManiphestBatchEditController extends ManiphestController {
$value = null; $value = null;
} }
break; break;
case ManiphestTransactionType::TYPE_PROJECTS: case ManiphestTransaction::TYPE_PROJECTS:
if (empty($value)) { if (empty($value)) {
continue 2; continue 2;
} }
break; break;
case ManiphestTransactionType::TYPE_CCS: case ManiphestTransaction::TYPE_CCS:
if (empty($value)) { if (empty($value)) {
continue 2; continue 2;
} }
@@ -265,8 +265,8 @@ final class ManiphestBatchEditController extends ManiphestController {
$value = $current."\n\n".$value; $value = $current."\n\n".$value;
} }
break; break;
case ManiphestTransactionType::TYPE_PROJECTS: case ManiphestTransaction::TYPE_PROJECTS:
case ManiphestTransactionType::TYPE_CCS: case ManiphestTransaction::TYPE_CCS:
$remove_actions = array( $remove_actions = array(
'remove_project' => true, 'remove_project' => true,
'remove_ccs' => true, 'remove_ccs' => true,

View File

@@ -100,7 +100,7 @@ final class ManiphestReportController extends ManiphestController {
ORDER BY x.dateCreated ASC', ORDER BY x.dateCreated ASC',
$table->getTableName(), $table->getTableName(),
$joins, $joins,
ManiphestTransactionType::TYPE_STATUS); ManiphestTransaction::TYPE_STATUS);
$stats = array(); $stats = array();
$day_buckets = array(); $day_buckets = array();

View File

@@ -146,9 +146,18 @@ final class ManiphestTaskDetailController extends ManiphestController {
$engine->process(); $engine->process();
$transaction_types = ManiphestTransactionType::getTransactionTypeMap();
$resolution_types = ManiphestTaskStatus::getTaskStatusMap(); $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) { if ($task->getStatus() == ManiphestTaskStatus::STATUS_OPEN) {
$resolution_types = array_select_keys( $resolution_types = array_select_keys(
$resolution_types, $resolution_types,
@@ -162,10 +171,10 @@ final class ManiphestTaskDetailController extends ManiphestController {
$resolution_types = array( $resolution_types = array(
ManiphestTaskStatus::STATUS_OPEN => 'Reopened', ManiphestTaskStatus::STATUS_OPEN => 'Reopened',
); );
$transaction_types[ManiphestTransactionType::TYPE_STATUS] = $transaction_types[ManiphestTransaction::TYPE_STATUS] =
'Reopen Task'; 'Reopen Task';
unset($transaction_types[ManiphestTransactionType::TYPE_PRIORITY]); unset($transaction_types[ManiphestTransaction::TYPE_PRIORITY]);
unset($transaction_types[ManiphestTransactionType::TYPE_OWNER]); unset($transaction_types[ManiphestTransaction::TYPE_OWNER]);
} }
$default_claim = array( $default_claim = array(
@@ -260,22 +269,22 @@ final class ManiphestTaskDetailController extends ManiphestController {
->setValue($is_serious ? pht('Submit') : pht('Avast!'))); ->setValue($is_serious ? pht('Submit') : pht('Avast!')));
$control_map = array( $control_map = array(
ManiphestTransactionType::TYPE_STATUS => 'resolution', ManiphestTransaction::TYPE_STATUS => 'resolution',
ManiphestTransactionType::TYPE_OWNER => 'assign_to', ManiphestTransaction::TYPE_OWNER => 'assign_to',
ManiphestTransactionType::TYPE_CCS => 'ccs', ManiphestTransaction::TYPE_CCS => 'ccs',
ManiphestTransactionType::TYPE_PRIORITY => 'priority', ManiphestTransaction::TYPE_PRIORITY => 'priority',
ManiphestTransactionType::TYPE_PROJECTS => 'projects', ManiphestTransaction::TYPE_PROJECTS => 'projects',
ManiphestTransactionType::TYPE_ATTACH => 'file', ManiphestTransaction::TYPE_ATTACH => 'file',
); );
$tokenizer_map = array( $tokenizer_map = array(
ManiphestTransactionType::TYPE_PROJECTS => array( ManiphestTransaction::TYPE_PROJECTS => array(
'id' => 'projects-tokenizer', 'id' => 'projects-tokenizer',
'src' => '/typeahead/common/projects/', 'src' => '/typeahead/common/projects/',
'ondemand' => PhabricatorEnv::getEnvConfig('tokenizer.ondemand'), 'ondemand' => PhabricatorEnv::getEnvConfig('tokenizer.ondemand'),
'placeholder' => pht('Type a project name...'), 'placeholder' => pht('Type a project name...'),
), ),
ManiphestTransactionType::TYPE_OWNER => array( ManiphestTransaction::TYPE_OWNER => array(
'id' => 'assign-tokenizer', 'id' => 'assign-tokenizer',
'src' => '/typeahead/common/users/', 'src' => '/typeahead/common/users/',
'value' => $default_claim, 'value' => $default_claim,
@@ -283,7 +292,7 @@ final class ManiphestTaskDetailController extends ManiphestController {
'ondemand' => PhabricatorEnv::getEnvConfig('tokenizer.ondemand'), 'ondemand' => PhabricatorEnv::getEnvConfig('tokenizer.ondemand'),
'placeholder' => pht('Type a user name...'), 'placeholder' => pht('Type a user name...'),
), ),
ManiphestTransactionType::TYPE_CCS => array( ManiphestTransaction::TYPE_CCS => array(
'id' => 'cc-tokenizer', 'id' => 'cc-tokenizer',
'src' => '/typeahead/common/mailable/', 'src' => '/typeahead/common/mailable/',
'ondemand' => PhabricatorEnv::getEnvConfig('tokenizer.ondemand'), 'ondemand' => PhabricatorEnv::getEnvConfig('tokenizer.ondemand'),

View File

@@ -108,18 +108,18 @@ final class ManiphestTaskEditController extends ManiphestController {
if ($task->getID()) { if ($task->getID()) {
if ($new_title != $task->getTitle()) { if ($new_title != $task->getTitle()) {
$changes[ManiphestTransactionType::TYPE_TITLE] = $new_title; $changes[ManiphestTransaction::TYPE_TITLE] = $new_title;
} }
if ($new_desc != $task->getDescription()) { if ($new_desc != $task->getDescription()) {
$changes[ManiphestTransactionType::TYPE_DESCRIPTION] = $new_desc; $changes[ManiphestTransaction::TYPE_DESCRIPTION] = $new_desc;
} }
if ($new_status != $task->getStatus()) { if ($new_status != $task->getStatus()) {
$changes[ManiphestTransactionType::TYPE_STATUS] = $new_status; $changes[ManiphestTransaction::TYPE_STATUS] = $new_status;
} }
} else { } else {
$task->setTitle($new_title); $task->setTitle($new_title);
$task->setDescription($new_desc); $task->setDescription($new_desc);
$changes[ManiphestTransactionType::TYPE_STATUS] = $changes[ManiphestTransaction::TYPE_STATUS] =
ManiphestTaskStatus::STATUS_OPEN; ManiphestTaskStatus::STATUS_OPEN;
$workflow = 'create'; $workflow = 'create';
@@ -172,16 +172,16 @@ final class ManiphestTaskEditController extends ManiphestController {
$task->setProjectPHIDs($request->getArr('projects')); $task->setProjectPHIDs($request->getArr('projects'));
} else { } else {
if ($request->getInt('priority') != $task->getPriority()) { if ($request->getInt('priority') != $task->getPriority()) {
$changes[ManiphestTransactionType::TYPE_PRIORITY] = $changes[ManiphestTransaction::TYPE_PRIORITY] =
$request->getInt('priority'); $request->getInt('priority');
} }
if ($owner_phid != $task->getOwnerPHID()) { if ($owner_phid != $task->getOwnerPHID()) {
$changes[ManiphestTransactionType::TYPE_OWNER] = $owner_phid; $changes[ManiphestTransaction::TYPE_OWNER] = $owner_phid;
} }
if ($request->getArr('cc') != $task->getCCPHIDs()) { 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'); $new_proj_arr = $request->getArr('projects');
@@ -193,13 +193,13 @@ final class ManiphestTaskEditController extends ManiphestController {
sort($cur_proj_arr); sort($cur_proj_arr);
if ($new_proj_arr != $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) { if ($files) {
$file_map = mpull($files, 'getPHID'); $file_map = mpull($files, 'getPHID');
$file_map = array_fill_keys($file_map, array()); $file_map = array_fill_keys($file_map, array());
$changes[ManiphestTransactionType::TYPE_ATTACH] = array( $changes[ManiphestTransaction::TYPE_ATTACH] = array(
PhabricatorFilePHIDTypeFile::TYPECONST => $file_map, PhabricatorFilePHIDTypeFile::TYPECONST => $file_map,
); );
} }

View File

@@ -45,11 +45,11 @@ final class ManiphestTransactionPreviewController extends ManiphestController {
// grab phids for handles and set transaction values based on action and // grab phids for handles and set transaction values based on action and
// value (empty or control-specific format) coming in from the wire // value (empty or control-specific format) coming in from the wire
switch ($action) { switch ($action) {
case ManiphestTransactionType::TYPE_PRIORITY: case ManiphestTransaction::TYPE_PRIORITY:
$transaction->setOldValue($task->getPriority()); $transaction->setOldValue($task->getPriority());
$transaction->setNewValue($value); $transaction->setNewValue($value);
break; break;
case ManiphestTransactionType::TYPE_OWNER: case ManiphestTransaction::TYPE_OWNER:
if ($value) { if ($value) {
$value = current(json_decode($value)); $value = current(json_decode($value));
$phids = array($value); $phids = array($value);
@@ -58,7 +58,7 @@ final class ManiphestTransactionPreviewController extends ManiphestController {
} }
$transaction->setNewValue($value); $transaction->setNewValue($value);
break; break;
case ManiphestTransactionType::TYPE_CCS: case ManiphestTransaction::TYPE_CCS:
if ($value) { if ($value) {
$value = json_decode($value); $value = json_decode($value);
} }
@@ -75,7 +75,7 @@ final class ManiphestTransactionPreviewController extends ManiphestController {
$transaction->setOldValue($task->getCCPHIDs()); $transaction->setOldValue($task->getCCPHIDs());
$transaction->setNewValue($value); $transaction->setNewValue($value);
break; break;
case ManiphestTransactionType::TYPE_PROJECTS: case ManiphestTransaction::TYPE_PROJECTS:
if ($value) { if ($value) {
$value = json_decode($value); $value = json_decode($value);
} }

View File

@@ -33,7 +33,7 @@ final class ManiphestTransactionSaveController extends ManiphestController {
// This means "attach a file" even though we store other types of data // This means "attach a file" even though we store other types of data
// as 'attached'. // as 'attached'.
if ($action == ManiphestTransactionType::TYPE_ATTACH) { if ($action == ManiphestTransaction::TYPE_ATTACH) {
if (!empty($_FILES['file'])) { if (!empty($_FILES['file'])) {
$err = idx($_FILES['file'], 'error'); $err = idx($_FILES['file'], 'error');
if ($err != UPLOAD_ERR_NO_FILE) { if ($err != UPLOAD_ERR_NO_FILE) {
@@ -61,7 +61,7 @@ final class ManiphestTransactionSaveController extends ManiphestController {
} }
$transaction = new ManiphestTransaction(); $transaction = new ManiphestTransaction();
$transaction $transaction
->setTransactionType(ManiphestTransactionType::TYPE_ATTACH); ->setTransactionType(ManiphestTransaction::TYPE_ATTACH);
$transaction->setNewValue($new); $transaction->setNewValue($new);
$transactions[] = $transaction; $transactions[] = $transaction;
} }
@@ -78,29 +78,29 @@ final class ManiphestTransactionSaveController extends ManiphestController {
$cc_transaction = new ManiphestTransaction(); $cc_transaction = new ManiphestTransaction();
$cc_transaction $cc_transaction
->setTransactionType(ManiphestTransactionType::TYPE_CCS); ->setTransactionType(ManiphestTransaction::TYPE_CCS);
$transaction = new ManiphestTransaction(); $transaction = new ManiphestTransaction();
$transaction $transaction
->setTransactionType($action); ->setTransactionType($action);
switch ($action) { switch ($action) {
case ManiphestTransactionType::TYPE_STATUS: case ManiphestTransaction::TYPE_STATUS:
$transaction->setNewValue($request->getStr('resolution')); $transaction->setNewValue($request->getStr('resolution'));
break; break;
case ManiphestTransactionType::TYPE_OWNER: case ManiphestTransaction::TYPE_OWNER:
$assign_to = $request->getArr('assign_to'); $assign_to = $request->getArr('assign_to');
$assign_to = reset($assign_to); $assign_to = reset($assign_to);
$transaction->setNewValue($assign_to); $transaction->setNewValue($assign_to);
break; break;
case ManiphestTransactionType::TYPE_PROJECTS: case ManiphestTransaction::TYPE_PROJECTS:
$projects = $request->getArr('projects'); $projects = $request->getArr('projects');
$projects = array_merge($projects, $task->getProjectPHIDs()); $projects = array_merge($projects, $task->getProjectPHIDs());
$projects = array_filter($projects); $projects = array_filter($projects);
$projects = array_unique($projects); $projects = array_unique($projects);
$transaction->setNewValue($projects); $transaction->setNewValue($projects);
break; break;
case ManiphestTransactionType::TYPE_CCS: case ManiphestTransaction::TYPE_CCS:
// Accumulate the new explicit CCs into the array that we'll add in // Accumulate the new explicit CCs into the array that we'll add in
// the CC transaction later. // the CC transaction later.
$added_ccs = array_merge($added_ccs, $request->getArr('ccs')); $added_ccs = array_merge($added_ccs, $request->getArr('ccs'));
@@ -108,10 +108,10 @@ final class ManiphestTransactionSaveController extends ManiphestController {
// Throw away the primary transaction. // Throw away the primary transaction.
$transaction = null; $transaction = null;
break; break;
case ManiphestTransactionType::TYPE_PRIORITY: case ManiphestTransaction::TYPE_PRIORITY:
$transaction->setNewValue($request->getInt('priority')); $transaction->setNewValue($request->getInt('priority'));
break; break;
case ManiphestTransactionType::TYPE_ATTACH: case ManiphestTransaction::TYPE_ATTACH:
// Nuke this, we created it above. // Nuke this, we created it above.
$transaction = null; $transaction = null;
break; break;
@@ -143,7 +143,7 @@ final class ManiphestTransactionSaveController extends ManiphestController {
$implicitly_claimed = false; $implicitly_claimed = false;
switch ($action) { switch ($action) {
case ManiphestTransactionType::TYPE_OWNER: case ManiphestTransaction::TYPE_OWNER:
if ($task->getOwnerPHID() == $transaction->getNewValue()) { if ($task->getOwnerPHID() == $transaction->getNewValue()) {
// If this is actually no-op, don't generate the side effect. // If this is actually no-op, don't generate the side effect.
break; break;
@@ -151,14 +151,14 @@ final class ManiphestTransactionSaveController extends ManiphestController {
// Otherwise, when a task is reassigned, move the previous owner to CC. // Otherwise, when a task is reassigned, move the previous owner to CC.
$added_ccs[] = $task->getOwnerPHID(); $added_ccs[] = $task->getOwnerPHID();
break; break;
case ManiphestTransactionType::TYPE_STATUS: case ManiphestTransaction::TYPE_STATUS:
if (!$task->getOwnerPHID() && if (!$task->getOwnerPHID() &&
$request->getStr('resolution') != $request->getStr('resolution') !=
ManiphestTaskStatus::STATUS_OPEN) { ManiphestTaskStatus::STATUS_OPEN) {
// Closing an unassigned task. Assign the user as the owner of // Closing an unassigned task. Assign the user as the owner of
// this task. // this task.
$assign = new ManiphestTransaction(); $assign = new ManiphestTransaction();
$assign->setTransactionType(ManiphestTransactionType::TYPE_OWNER); $assign->setTransactionType(ManiphestTransaction::TYPE_OWNER);
$assign->setNewValue($user->getPHID()); $assign->setNewValue($user->getPHID());
$transactions[] = $assign; $transactions[] = $assign;
@@ -172,7 +172,7 @@ final class ManiphestTransactionSaveController extends ManiphestController {
if ($implicitly_claimed) { if ($implicitly_claimed) {
$user_owns_task = true; $user_owns_task = true;
} else { } else {
if ($action == ManiphestTransactionType::TYPE_OWNER) { if ($action == ManiphestTransaction::TYPE_OWNER) {
if ($transaction->getNewValue() == $user->getPHID()) { if ($transaction->getNewValue() == $user->getPHID()) {
$user_owns_task = true; $user_owns_task = true;
} }

View File

@@ -82,7 +82,7 @@ final class ManiphestEdgeEventListener extends PhutilEventListener {
} }
$xactions[] = id(new ManiphestTransaction()) $xactions[] = id(new ManiphestTransaction())
->setTransactionType(ManiphestTransactionType::TYPE_EDGE) ->setTransactionType(ManiphestTransaction::TYPE_EDGE)
->setOldValue($old_type) ->setOldValue($old_type)
->setNewValue($new_type) ->setNewValue($new_type)
->setMetadataValue('edge:type', $type); ->setMetadataValue('edge:type', $type);

View File

@@ -20,19 +20,19 @@ final class PhabricatorManiphestTaskTestDataGenerator
$template = new ManiphestTransaction(); $template = new ManiphestTransaction();
// Accumulate Transactions // Accumulate Transactions
$changes = array(); $changes = array();
$changes[ManiphestTransactionType::TYPE_TITLE] = $changes[ManiphestTransaction::TYPE_TITLE] =
$this->generateTitle(); $this->generateTitle();
$changes[ManiphestTransactionType::TYPE_DESCRIPTION] = $changes[ManiphestTransaction::TYPE_DESCRIPTION] =
$this->generateDescription(); $this->generateDescription();
$changes[ManiphestTransactionType::TYPE_OWNER] = $changes[ManiphestTransaction::TYPE_OWNER] =
$this->loadOwnerPHID(); $this->loadOwnerPHID();
$changes[ManiphestTransactionType::TYPE_STATUS] = $changes[ManiphestTransaction::TYPE_STATUS] =
$this->generateTaskStatus(); $this->generateTaskStatus();
$changes[ManiphestTransactionType::TYPE_PRIORITY] = $changes[ManiphestTransaction::TYPE_PRIORITY] =
$this->generateTaskPriority(); $this->generateTaskPriority();
$changes[ManiphestTransactionType::TYPE_CCS] = $changes[ManiphestTransaction::TYPE_CCS] =
$this->getCCPHIDs(); $this->getCCPHIDs();
$changes[ManiphestTransactionType::TYPE_PROJECTS] = $changes[ManiphestTransaction::TYPE_PROJECTS] =
$this->getProjectPHIDs(); $this->getProjectPHIDs();
$transactions = array(); $transactions = array();
foreach ($changes as $type => $value) { foreach ($changes as $type => $value) {

View File

@@ -63,7 +63,7 @@ final class ManiphestReplyHandler extends PhabricatorMailReplyHandler {
// If this is a new task, create a "User created this task." transaction // If this is a new task, create a "User created this task." transaction
// and then set the title and description. // and then set the title and description.
$xaction = clone $template; $xaction = clone $template;
$xaction->setTransactionType(ManiphestTransactionType::TYPE_STATUS); $xaction->setTransactionType(ManiphestTransaction::TYPE_STATUS);
$xaction->setNewValue(ManiphestTaskStatus::STATUS_OPEN); $xaction->setNewValue(ManiphestTaskStatus::STATUS_OPEN);
$xactions[] = $xaction; $xactions[] = $xaction;
@@ -90,16 +90,16 @@ final class ManiphestReplyHandler extends PhabricatorMailReplyHandler {
$new_value = null; $new_value = null;
switch ($command) { switch ($command) {
case 'close': case 'close':
$ttype = ManiphestTransactionType::TYPE_STATUS; $ttype = ManiphestTransaction::TYPE_STATUS;
$new_value = ManiphestTaskStatus::STATUS_CLOSED_RESOLVED; $new_value = ManiphestTaskStatus::STATUS_CLOSED_RESOLVED;
break; break;
case 'claim': case 'claim':
$ttype = ManiphestTransactionType::TYPE_OWNER; $ttype = ManiphestTransaction::TYPE_OWNER;
$new_value = $user->getPHID(); $new_value = $user->getPHID();
break; break;
case 'unsubscribe': case 'unsubscribe':
$is_unsub = true; $is_unsub = true;
$ttype = ManiphestTransactionType::TYPE_CCS; $ttype = ManiphestTransaction::TYPE_CCS;
$ccs = $task->getCCPHIDs(); $ccs = $task->getCCPHIDs();
foreach ($ccs as $k => $phid) { foreach ($ccs as $k => $phid) {
if ($phid == $user->getPHID()) { if ($phid == $user->getPHID()) {
@@ -138,7 +138,7 @@ final class ManiphestReplyHandler extends PhabricatorMailReplyHandler {
if (array_diff($new_ccs, $old_ccs)) { if (array_diff($new_ccs, $old_ccs)) {
$cc_xaction = clone $template; $cc_xaction = clone $template;
$cc_xaction->setTransactionType(ManiphestTransactionType::TYPE_CCS); $cc_xaction->setTransactionType(ManiphestTransaction::TYPE_CCS);
$cc_xaction->setNewValue($new_ccs); $cc_xaction->setNewValue($new_ccs);
$xactions[] = $cc_xaction; $xactions[] = $cc_xaction;
} }

View File

@@ -176,7 +176,7 @@ final class PhabricatorSearchAttachController
$target->getOwnerPHID()); $target->getOwnerPHID());
$close_task = id(new ManiphestTransaction()) $close_task = id(new ManiphestTransaction())
->setTransactionType(ManiphestTransactionType::TYPE_STATUS) ->setTransactionType(ManiphestTransaction::TYPE_STATUS)
->setNewValue(ManiphestTaskStatus::STATUS_CLOSED_DUPLICATE); ->setNewValue(ManiphestTaskStatus::STATUS_CLOSED_DUPLICATE);
$merge_comment = id(new ManiphestTransaction()) $merge_comment = id(new ManiphestTransaction())
@@ -201,7 +201,7 @@ final class PhabricatorSearchAttachController
$task_names = implode(', ', $task_names); $task_names = implode(', ', $task_names);
$add_ccs = id(new ManiphestTransaction()) $add_ccs = id(new ManiphestTransaction())
->setTransactionType(ManiphestTransactionType::TYPE_CCS) ->setTransactionType(ManiphestTransaction::TYPE_CCS)
->setNewValue($all_ccs); ->setNewValue($all_ccs);
$merged_comment = id(new ManiphestTransaction()) $merged_comment = id(new ManiphestTransaction())