@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+27 -23
+6 -9
src/applications/maniphest/controller/ManiphestBatchEditController.php
··· 171 171 'assign' => ManiphestTransaction::TYPE_OWNER, 172 172 'status' => ManiphestTransaction::TYPE_STATUS, 173 173 'priority' => ManiphestTransaction::TYPE_PRIORITY, 174 - 'add_project' => ManiphestTransaction::TYPE_PROJECTS, 175 - 'remove_project' => ManiphestTransaction::TYPE_PROJECTS, 174 + 'add_project' => PhabricatorTransactions::TYPE_EDGE, 175 + 'remove_project' => PhabricatorTransactions::TYPE_EDGE, 176 176 'add_ccs' => PhabricatorTransactions::TYPE_SUBSCRIBERS, 177 177 'remove_ccs' => PhabricatorTransactions::TYPE_SUBSCRIBERS, 178 178 ); ··· 214 214 case ManiphestTransaction::TYPE_PRIORITY: 215 215 $current = $task->getPriority(); 216 216 break; 217 - case ManiphestTransaction::TYPE_PROJECTS: 217 + case PhabricatorTransactions::TYPE_EDGE: 218 218 $current = $task->getProjectPHIDs(); 219 219 break; 220 220 case PhabricatorTransactions::TYPE_SUBSCRIBERS: ··· 243 243 $value = null; 244 244 } 245 245 break; 246 - case ManiphestTransaction::TYPE_PROJECTS: 246 + case PhabricatorTransactions::TYPE_EDGE: 247 247 if (empty($value)) { 248 248 continue 2; 249 249 } ··· 275 275 $value = $current."\n\n".$value; 276 276 } 277 277 break; 278 - case ManiphestTransaction::TYPE_PROJECTS: 278 + case PhabricatorTransactions::TYPE_EDGE: 279 279 $is_remove = $action['action'] == 'remove_project'; 280 280 281 281 $current = array_fill_keys($current, true); ··· 356 356 id(new ManiphestTransactionComment()) 357 357 ->setContent($value)); 358 358 break; 359 - case ManiphestTransaction::TYPE_PROJECTS: 360 - 361 - // TODO: Clean this mess up. 359 + case PhabricatorTransactions::TYPE_EDGE: 362 360 $project_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST; 363 361 $xaction 364 - ->setTransactionType(PhabricatorTransactions::TYPE_EDGE) 365 362 ->setMetadataValue('edge:type', $project_type) 366 363 ->setNewValue( 367 364 array(
+4 -4
src/applications/maniphest/controller/ManiphestTaskDetailController.php
··· 139 139 ManiphestTransaction::TYPE_OWNER => pht('Reassign / Claim'), 140 140 PhabricatorTransactions::TYPE_SUBSCRIBERS => pht('Add CCs'), 141 141 ManiphestTransaction::TYPE_PRIORITY => pht('Change Priority'), 142 - ManiphestTransaction::TYPE_PROJECTS => pht('Associate Projects'), 142 + PhabricatorTransactions::TYPE_EDGE => pht('Associate Projects'), 143 143 ); 144 144 145 145 // Remove actions the user doesn't have permission to take. ··· 149 149 ManiphestEditAssignCapability::CAPABILITY, 150 150 ManiphestTransaction::TYPE_PRIORITY => 151 151 ManiphestEditPriorityCapability::CAPABILITY, 152 - ManiphestTransaction::TYPE_PROJECTS => 152 + PhabricatorTransactions::TYPE_EDGE => 153 153 ManiphestEditProjectsCapability::CAPABILITY, 154 154 ManiphestTransaction::TYPE_STATUS => 155 155 ManiphestEditStatusCapability::CAPABILITY, ··· 264 264 ManiphestTransaction::TYPE_OWNER => 'assign_to', 265 265 PhabricatorTransactions::TYPE_SUBSCRIBERS => 'ccs', 266 266 ManiphestTransaction::TYPE_PRIORITY => 'priority', 267 - ManiphestTransaction::TYPE_PROJECTS => 'projects', 267 + PhabricatorTransactions::TYPE_EDGE => 'projects', 268 268 ); 269 269 270 270 $projects_source = new PhabricatorProjectDatasource(); ··· 272 272 $mailable_source = new PhabricatorMetaMTAMailableDatasource(); 273 273 274 274 $tokenizer_map = array( 275 - ManiphestTransaction::TYPE_PROJECTS => array( 275 + PhabricatorTransactions::TYPE_EDGE => array( 276 276 'id' => 'projects-tokenizer', 277 277 'src' => $projects_source->getDatasourceURI(), 278 278 'placeholder' => $projects_source->getPlaceholderText(),
+2 -4
src/applications/maniphest/controller/ManiphestTaskEditController.php
··· 234 234 235 235 if ($can_edit_projects) { 236 236 $projects = $request->getArr('projects'); 237 - $changes[ManiphestTransaction::TYPE_PROJECTS] = 237 + $changes[PhabricatorTransactions::TYPE_EDGE] = 238 238 $projects; 239 239 $column_phid = $request->getStr('columnPHID'); 240 240 // allow for putting a task in a project column at creation -only- ··· 276 276 if ($type == ManiphestTransaction::TYPE_PROJECT_COLUMN) { 277 277 $transaction->setNewValue($value['new']); 278 278 $transaction->setOldValue($value['old']); 279 - } else if ($type == ManiphestTransaction::TYPE_PROJECTS) { 280 - // TODO: Gross. 279 + } else if ($type == PhabricatorTransactions::TYPE_EDGE) { 281 280 $project_type = 282 281 PhabricatorProjectObjectHasProjectEdgeType::EDGECONST; 283 282 $transaction 284 - ->setTransactionType(PhabricatorTransactions::TYPE_EDGE) 285 283 ->setMetadataValue('edge:type', $project_type) 286 284 ->setNewValue( 287 285 array(
+1 -1
src/applications/maniphest/controller/ManiphestTransactionPreviewController.php
··· 72 72 $transaction->setOldValue(array()); 73 73 $transaction->setNewValue($phids); 74 74 break; 75 - case ManiphestTransaction::TYPE_PROJECTS: 75 + case PhabricatorTransactions::TYPE_EDGE: 76 76 if ($value) { 77 77 $value = json_decode($value); 78 78 }
+1 -3
src/applications/maniphest/controller/ManiphestTransactionSaveController.php
··· 50 50 $assign_to = reset($assign_to); 51 51 $transaction->setNewValue($assign_to); 52 52 break; 53 - case ManiphestTransaction::TYPE_PROJECTS: 53 + case PhabricatorTransactions::TYPE_EDGE: 54 54 $projects = $request->getArr('projects'); 55 55 $projects = array_merge($projects, $task->getProjectPHIDs()); 56 56 $projects = array_filter($projects); 57 57 $projects = array_unique($projects); 58 58 59 - // TODO: Bleh. 60 59 $project_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST; 61 60 $transaction 62 - ->setTransactionType(PhabricatorTransactions::TYPE_EDGE) 63 61 ->setMetadataValue('edge:type', $project_type) 64 62 ->setNewValue( 65 63 array(
+6
src/applications/project/edge/PhabricatorProjectObjectHasProjectEdgeType.php
··· 9 9 return PhabricatorProjectProjectHasObjectEdgeType::EDGECONST; 10 10 } 11 11 12 + public function getTransactionPreviewString($actor) { 13 + return pht( 14 + '%s edited associated projects.', 15 + $actor); 16 + } 17 + 12 18 public function getTransactionAddString( 13 19 $actor, 14 20 $add_count,
+1 -2
src/applications/transactions/storage/PhabricatorApplicationTransaction.php
··· 667 667 new PhutilNumber(count($rem)), 668 668 $this->renderHandleList($rem)); 669 669 } else { 670 - return pht( 671 - '%s edited edge metadata.', 670 + return $type_obj->getTransactionPreviewString( 672 671 $this->renderHandleLink($author_phid)); 673 672 } 674 673
+6
src/infrastructure/edges/type/PhabricatorEdgeType.php
··· 46 46 return false; 47 47 } 48 48 49 + public function getTransactionPreviewString($actor) { 50 + return pht( 51 + '%s edited edge metadata.', 52 + $actor); 53 + } 54 + 49 55 public function getTransactionAddString( 50 56 $actor, 51 57 $add_count,