mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-27 01:02:42 +01:00
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:
parent
b16a390509
commit
bb4bf01bdc
14 changed files with 98 additions and 123 deletions
|
@ -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',
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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'),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
|
@ -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,
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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'),
|
||||
|
|
|
@ -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,
|
||||
);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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())
|
||||
|
|
Loading…
Reference in a new issue