mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-18 02:31:10 +01:00
Maniphest - remove references to deprecated transaction type TYPE_PROJECTS from code
Summary: ...except the transaction class itself, which still needs some knowledge of these transactions for older installs. Ref T5245. T5604 and T5245 are now in a similar place -- there's an unknown set of bugs introduced from my changes and there's still old display code lying around with some old transactions in the database. I'll stomp out the bugs if / when they surface and data migration is up next. This revision also adds a "TransactionPreviewString" method to the edge objects so that we can have a prettier "Bob edited associated projects." preview of this transaction. Test Plan: added a project from task detail and saw correct preview throughout process with correct project added. bulk removed a project from some tasks. added a project from the edit details pane. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T5245 Differential Revision: https://secure.phabricator.com/D11013
This commit is contained in:
parent
2d3f5dae3c
commit
10f2cfec5b
8 changed files with 27 additions and 23 deletions
|
@ -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(
|
||||
|
|
|
@ -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(),
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue