@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.

Update Maniphest for modular transactions

Summary: Ref T12671. This modernized Maniphest transactions to modular transactions.

Test Plan:
- Create Task
- Edit Task
- Raise Priority
- Change Status
- Merge as a duplicate
- Create Subtask
- Claim Task
- Assign Project
- Move on Workboard
- Set a cover image
- Assign story points
- Change story points
- Generate lots via lipsum
- Bulk edit tasks
- Leave comments
- Award Token

I'm sure I'm missing something.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: hazelyang, Korvin

Maniphest Tasks: T12671

Differential Revision: https://secure.phabricator.com/D17844

+1401 -1166
+2 -1
resources/sql/autopatches/20140321.mstatus.2.mig.php
··· 35 35 $id = $xaction->getID(); 36 36 echo pht('Migrating %d...', $id)."\n"; 37 37 38 - if ($xaction->getTransactionType() == ManiphestTransaction::TYPE_STATUS) { 38 + $xn_type = ManiphestTaskStatusTransaction::TRANSACTIONTYPE; 39 + if ($xaction->getTransactionType() == $xn_type) { 39 40 $old = $xaction->getOldValue(); 40 41 if ($old !== null && isset($status_map[$old])) { 41 42 $old = $status_map[$old];
+31 -1
src/__phutil_library_map__.php
··· 1511 1511 'ManiphestTaskAssignOtherHeraldAction' => 'applications/maniphest/herald/ManiphestTaskAssignOtherHeraldAction.php', 1512 1512 'ManiphestTaskAssignSelfHeraldAction' => 'applications/maniphest/herald/ManiphestTaskAssignSelfHeraldAction.php', 1513 1513 'ManiphestTaskAssigneeHeraldField' => 'applications/maniphest/herald/ManiphestTaskAssigneeHeraldField.php', 1514 + 'ManiphestTaskAttachTransaction' => 'applications/maniphest/xaction/ManiphestTaskAttachTransaction.php', 1514 1515 'ManiphestTaskAuthorHeraldField' => 'applications/maniphest/herald/ManiphestTaskAuthorHeraldField.php', 1515 1516 'ManiphestTaskAuthorPolicyRule' => 'applications/maniphest/policyrule/ManiphestTaskAuthorPolicyRule.php', 1516 1517 'ManiphestTaskCloseAsDuplicateRelationship' => 'applications/maniphest/relationship/ManiphestTaskCloseAsDuplicateRelationship.php', 1517 1518 'ManiphestTaskClosedStatusDatasource' => 'applications/maniphest/typeahead/ManiphestTaskClosedStatusDatasource.php', 1519 + 'ManiphestTaskCoverImageTransaction' => 'applications/maniphest/xaction/ManiphestTaskCoverImageTransaction.php', 1518 1520 'ManiphestTaskDependedOnByTaskEdgeType' => 'applications/maniphest/edge/ManiphestTaskDependedOnByTaskEdgeType.php', 1519 1521 'ManiphestTaskDependsOnTaskEdgeType' => 'applications/maniphest/edge/ManiphestTaskDependsOnTaskEdgeType.php', 1520 1522 'ManiphestTaskDescriptionHeraldField' => 'applications/maniphest/herald/ManiphestTaskDescriptionHeraldField.php', 1523 + 'ManiphestTaskDescriptionTransaction' => 'applications/maniphest/xaction/ManiphestTaskDescriptionTransaction.php', 1521 1524 'ManiphestTaskDetailController' => 'applications/maniphest/controller/ManiphestTaskDetailController.php', 1525 + 'ManiphestTaskEdgeTransaction' => 'applications/maniphest/xaction/ManiphestTaskEdgeTransaction.php', 1522 1526 'ManiphestTaskEditBulkJobType' => 'applications/maniphest/bulk/ManiphestTaskEditBulkJobType.php', 1523 1527 'ManiphestTaskEditController' => 'applications/maniphest/controller/ManiphestTaskEditController.php', 1524 1528 'ManiphestTaskEditEngineLock' => 'applications/maniphest/editor/ManiphestTaskEditEngineLock.php', ··· 1541 1545 'ManiphestTaskListView' => 'applications/maniphest/view/ManiphestTaskListView.php', 1542 1546 'ManiphestTaskMailReceiver' => 'applications/maniphest/mail/ManiphestTaskMailReceiver.php', 1543 1547 'ManiphestTaskMergeInRelationship' => 'applications/maniphest/relationship/ManiphestTaskMergeInRelationship.php', 1548 + 'ManiphestTaskMergedFromTransaction' => 'applications/maniphest/xaction/ManiphestTaskMergedFromTransaction.php', 1549 + 'ManiphestTaskMergedIntoTransaction' => 'applications/maniphest/xaction/ManiphestTaskMergedIntoTransaction.php', 1544 1550 'ManiphestTaskOpenStatusDatasource' => 'applications/maniphest/typeahead/ManiphestTaskOpenStatusDatasource.php', 1551 + 'ManiphestTaskOwnerTransaction' => 'applications/maniphest/xaction/ManiphestTaskOwnerTransaction.php', 1545 1552 'ManiphestTaskPHIDResolver' => 'applications/maniphest/httpparametertype/ManiphestTaskPHIDResolver.php', 1546 1553 'ManiphestTaskPHIDType' => 'applications/maniphest/phid/ManiphestTaskPHIDType.php', 1554 + 'ManiphestTaskParentTransaction' => 'applications/maniphest/xaction/ManiphestTaskParentTransaction.php', 1547 1555 'ManiphestTaskPoints' => 'applications/maniphest/constants/ManiphestTaskPoints.php', 1556 + 'ManiphestTaskPointsTransaction' => 'applications/maniphest/xaction/ManiphestTaskPointsTransaction.php', 1548 1557 'ManiphestTaskPriority' => 'applications/maniphest/constants/ManiphestTaskPriority.php', 1549 1558 'ManiphestTaskPriorityDatasource' => 'applications/maniphest/typeahead/ManiphestTaskPriorityDatasource.php', 1550 1559 'ManiphestTaskPriorityHeraldAction' => 'applications/maniphest/herald/ManiphestTaskPriorityHeraldAction.php', 1551 1560 'ManiphestTaskPriorityHeraldField' => 'applications/maniphest/herald/ManiphestTaskPriorityHeraldField.php', 1561 + 'ManiphestTaskPriorityTransaction' => 'applications/maniphest/xaction/ManiphestTaskPriorityTransaction.php', 1552 1562 'ManiphestTaskQuery' => 'applications/maniphest/query/ManiphestTaskQuery.php', 1553 1563 'ManiphestTaskRelationship' => 'applications/maniphest/relationship/ManiphestTaskRelationship.php', 1554 1564 'ManiphestTaskRelationshipSource' => 'applications/search/relationship/ManiphestTaskRelationshipSource.php', ··· 1560 1570 'ManiphestTaskStatusHeraldAction' => 'applications/maniphest/herald/ManiphestTaskStatusHeraldAction.php', 1561 1571 'ManiphestTaskStatusHeraldField' => 'applications/maniphest/herald/ManiphestTaskStatusHeraldField.php', 1562 1572 'ManiphestTaskStatusTestCase' => 'applications/maniphest/constants/__tests__/ManiphestTaskStatusTestCase.php', 1573 + 'ManiphestTaskStatusTransaction' => 'applications/maniphest/xaction/ManiphestTaskStatusTransaction.php', 1574 + 'ManiphestTaskSubpriorityTransaction' => 'applications/maniphest/xaction/ManiphestTaskSubpriorityTransaction.php', 1563 1575 'ManiphestTaskSubtypeDatasource' => 'applications/maniphest/typeahead/ManiphestTaskSubtypeDatasource.php', 1564 1576 'ManiphestTaskTestCase' => 'applications/maniphest/__tests__/ManiphestTaskTestCase.php', 1565 1577 'ManiphestTaskTitleHeraldField' => 'applications/maniphest/herald/ManiphestTaskTitleHeraldField.php', 1578 + 'ManiphestTaskTitleTransaction' => 'applications/maniphest/xaction/ManiphestTaskTitleTransaction.php', 1579 + 'ManiphestTaskTransactionType' => 'applications/maniphest/xaction/ManiphestTaskTransactionType.php', 1580 + 'ManiphestTaskUnblockTransaction' => 'applications/maniphest/xaction/ManiphestTaskUnblockTransaction.php', 1566 1581 'ManiphestTransaction' => 'applications/maniphest/storage/ManiphestTransaction.php', 1567 1582 'ManiphestTransactionComment' => 'applications/maniphest/storage/ManiphestTransactionComment.php', 1568 1583 'ManiphestTransactionEditor' => 'applications/maniphest/editor/ManiphestTransactionEditor.php', ··· 6569 6584 'ManiphestTaskAssignOtherHeraldAction' => 'ManiphestTaskAssignHeraldAction', 6570 6585 'ManiphestTaskAssignSelfHeraldAction' => 'ManiphestTaskAssignHeraldAction', 6571 6586 'ManiphestTaskAssigneeHeraldField' => 'ManiphestTaskHeraldField', 6587 + 'ManiphestTaskAttachTransaction' => 'ManiphestTaskTransactionType', 6572 6588 'ManiphestTaskAuthorHeraldField' => 'ManiphestTaskHeraldField', 6573 6589 'ManiphestTaskAuthorPolicyRule' => 'PhabricatorPolicyRule', 6574 6590 'ManiphestTaskCloseAsDuplicateRelationship' => 'ManiphestTaskRelationship', 6575 6591 'ManiphestTaskClosedStatusDatasource' => 'PhabricatorTypeaheadDatasource', 6592 + 'ManiphestTaskCoverImageTransaction' => 'ManiphestTaskTransactionType', 6576 6593 'ManiphestTaskDependedOnByTaskEdgeType' => 'PhabricatorEdgeType', 6577 6594 'ManiphestTaskDependsOnTaskEdgeType' => 'PhabricatorEdgeType', 6578 6595 'ManiphestTaskDescriptionHeraldField' => 'ManiphestTaskHeraldField', 6596 + 'ManiphestTaskDescriptionTransaction' => 'ManiphestTaskTransactionType', 6579 6597 'ManiphestTaskDetailController' => 'ManiphestController', 6598 + 'ManiphestTaskEdgeTransaction' => 'ManiphestTaskTransactionType', 6580 6599 'ManiphestTaskEditBulkJobType' => 'PhabricatorWorkerBulkJobType', 6581 6600 'ManiphestTaskEditController' => 'ManiphestController', 6582 6601 'ManiphestTaskEditEngineLock' => 'PhabricatorEditEngineLock', ··· 6599 6618 'ManiphestTaskListView' => 'ManiphestView', 6600 6619 'ManiphestTaskMailReceiver' => 'PhabricatorObjectMailReceiver', 6601 6620 'ManiphestTaskMergeInRelationship' => 'ManiphestTaskRelationship', 6621 + 'ManiphestTaskMergedFromTransaction' => 'ManiphestTaskTransactionType', 6622 + 'ManiphestTaskMergedIntoTransaction' => 'ManiphestTaskTransactionType', 6602 6623 'ManiphestTaskOpenStatusDatasource' => 'PhabricatorTypeaheadDatasource', 6624 + 'ManiphestTaskOwnerTransaction' => 'ManiphestTaskTransactionType', 6603 6625 'ManiphestTaskPHIDResolver' => 'PhabricatorPHIDResolver', 6604 6626 'ManiphestTaskPHIDType' => 'PhabricatorPHIDType', 6627 + 'ManiphestTaskParentTransaction' => 'ManiphestTaskTransactionType', 6605 6628 'ManiphestTaskPoints' => 'Phobject', 6629 + 'ManiphestTaskPointsTransaction' => 'ManiphestTaskTransactionType', 6606 6630 'ManiphestTaskPriority' => 'ManiphestConstants', 6607 6631 'ManiphestTaskPriorityDatasource' => 'PhabricatorTypeaheadDatasource', 6608 6632 'ManiphestTaskPriorityHeraldAction' => 'HeraldAction', 6609 6633 'ManiphestTaskPriorityHeraldField' => 'ManiphestTaskHeraldField', 6634 + 'ManiphestTaskPriorityTransaction' => 'ManiphestTaskTransactionType', 6610 6635 'ManiphestTaskQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 6611 6636 'ManiphestTaskRelationship' => 'PhabricatorObjectRelationship', 6612 6637 'ManiphestTaskRelationshipSource' => 'PhabricatorObjectRelationshipSource', ··· 6618 6643 'ManiphestTaskStatusHeraldAction' => 'HeraldAction', 6619 6644 'ManiphestTaskStatusHeraldField' => 'ManiphestTaskHeraldField', 6620 6645 'ManiphestTaskStatusTestCase' => 'PhabricatorTestCase', 6646 + 'ManiphestTaskStatusTransaction' => 'ManiphestTaskTransactionType', 6647 + 'ManiphestTaskSubpriorityTransaction' => 'ManiphestTaskTransactionType', 6621 6648 'ManiphestTaskSubtypeDatasource' => 'PhabricatorTypeaheadDatasource', 6622 6649 'ManiphestTaskTestCase' => 'PhabricatorTestCase', 6623 6650 'ManiphestTaskTitleHeraldField' => 'ManiphestTaskHeraldField', 6624 - 'ManiphestTransaction' => 'PhabricatorApplicationTransaction', 6651 + 'ManiphestTaskTitleTransaction' => 'ManiphestTaskTransactionType', 6652 + 'ManiphestTaskTransactionType' => 'PhabricatorModularTransactionType', 6653 + 'ManiphestTaskUnblockTransaction' => 'ManiphestTaskTransactionType', 6654 + 'ManiphestTransaction' => 'PhabricatorModularTransaction', 6625 6655 'ManiphestTransactionComment' => 'PhabricatorApplicationTransactionComment', 6626 6656 'ManiphestTransactionEditor' => 'PhabricatorApplicationTransactionEditor', 6627 6657 'ManiphestTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
+3 -2
src/applications/files/storage/__tests__/PhabricatorFileTestCase.php
··· 94 94 95 95 $xactions = array(); 96 96 $xactions[] = id(new ManiphestTransaction()) 97 - ->setTransactionType(ManiphestTransaction::TYPE_TITLE) 97 + ->setTransactionType(ManiphestTaskTitleTransaction::TRANSACTIONTYPE) 98 98 ->setNewValue(pht('File Scramble Test Task')); 99 99 100 100 $xactions[] = id(new ManiphestTransaction()) 101 - ->setTransactionType(ManiphestTransaction::TYPE_DESCRIPTION) 101 + ->setTransactionType( 102 + ManiphestTaskDescriptionTransaction::TRANSACTIONTYPE) 102 103 ->setNewValue('{'.$file->getMonogram().'}'); 103 104 104 105 id(new ManiphestTransactionEditor())
+5 -5
src/applications/maniphest/__tests__/ManiphestTaskTestCase.php
··· 133 133 $xactions = array(); 134 134 135 135 $xactions[] = id(new ManiphestTransaction()) 136 - ->setTransactionType(ManiphestTransaction::TYPE_TITLE) 136 + ->setTransactionType(ManiphestTaskTitleTransaction::TRANSACTIONTYPE) 137 137 ->setNewValue($title); 138 138 139 139 ··· 169 169 $xactions = array(); 170 170 171 171 $xactions[] = id(new ManiphestTransaction()) 172 - ->setTransactionType(ManiphestTransaction::TYPE_PRIORITY) 172 + ->setTransactionType(ManiphestTaskPriorityTransaction::TRANSACTIONTYPE) 173 173 ->setNewValue($pri); 174 174 175 175 $xactions[] = id(new ManiphestTransaction()) 176 - ->setTransactionType(ManiphestTransaction::TYPE_SUBPRIORITY) 176 + ->setTransactionType(ManiphestTaskSubpriorityTransaction::TRANSACTIONTYPE) 177 177 ->setNewValue($sub); 178 178 179 179 return $this->applyTaskTransactions($viewer, $src, $xactions); ··· 192 192 $xactions = array(); 193 193 194 194 $xactions[] = id(new ManiphestTransaction()) 195 - ->setTransactionType(ManiphestTransaction::TYPE_PRIORITY) 195 + ->setTransactionType(ManiphestTaskPriorityTransaction::TRANSACTIONTYPE) 196 196 ->setNewValue($pri); 197 197 198 198 $xactions[] = id(new ManiphestTransaction()) 199 - ->setTransactionType(ManiphestTransaction::TYPE_SUBPRIORITY) 199 + ->setTransactionType(ManiphestTaskSubpriorityTransaction::TRANSACTIONTYPE) 200 200 ->setNewValue($sub); 201 201 202 202 return $this->applyTaskTransactions($viewer, $src, $xactions);
+7 -7
src/applications/maniphest/bulk/ManiphestTaskEditBulkJobType.php
··· 76 76 $value_map = array(); 77 77 $type_map = array( 78 78 'add_comment' => PhabricatorTransactions::TYPE_COMMENT, 79 - 'assign' => ManiphestTransaction::TYPE_OWNER, 80 - 'status' => ManiphestTransaction::TYPE_STATUS, 81 - 'priority' => ManiphestTransaction::TYPE_PRIORITY, 79 + 'assign' => ManiphestTaskOwnerTransaction::TRANSACTIONTYPE, 80 + 'status' => ManiphestTaskStatusTransaction::TRANSACTIONTYPE, 81 + 'priority' => ManiphestTaskPriorityTransaction::TRANSACTIONTYPE, 82 82 'add_project' => PhabricatorTransactions::TYPE_EDGE, 83 83 'remove_project' => PhabricatorTransactions::TYPE_EDGE, 84 84 'add_ccs' => PhabricatorTransactions::TYPE_SUBSCRIBERS, ··· 114 114 case PhabricatorTransactions::TYPE_COMMENT: 115 115 $current = null; 116 116 break; 117 - case ManiphestTransaction::TYPE_OWNER: 117 + case ManiphestTaskOwnerTransaction::TRANSACTIONTYPE: 118 118 $current = $task->getOwnerPHID(); 119 119 break; 120 - case ManiphestTransaction::TYPE_STATUS: 120 + case ManiphestTaskStatusTransaction::TRANSACTIONTYPE: 121 121 $current = $task->getStatus(); 122 122 break; 123 - case ManiphestTransaction::TYPE_PRIORITY: 123 + case ManiphestTaskPriorityTransaction::TRANSACTIONTYPE: 124 124 $current = $task->getPriority(); 125 125 break; 126 126 case PhabricatorTransactions::TYPE_EDGE: ··· 153 153 } 154 154 $value = head($value); 155 155 break; 156 - case ManiphestTransaction::TYPE_OWNER: 156 + case ManiphestTaskOwnerTransaction::TRANSACTIONTYPE: 157 157 if (empty($value)) { 158 158 continue 2; 159 159 }
+1 -1
src/applications/maniphest/command/ManiphestAssignEmailCommand.php
··· 53 53 } 54 54 55 55 $xactions[] = $object->getApplicationTransactionTemplate() 56 - ->setTransactionType(ManiphestTransaction::TYPE_OWNER) 56 + ->setTransactionType(ManiphestTaskOwnerTransaction::TRANSACTIONTYPE) 57 57 ->setNewValue($assign_phid); 58 58 59 59 return $xactions;
+1 -1
src/applications/maniphest/command/ManiphestClaimEmailCommand.php
··· 23 23 $xactions = array(); 24 24 25 25 $xactions[] = $object->getApplicationTransactionTemplate() 26 - ->setTransactionType(ManiphestTransaction::TYPE_OWNER) 26 + ->setTransactionType(ManiphestTaskOwnerTransaction::TRANSACTIONTYPE) 27 27 ->setNewValue($viewer->getPHID()); 28 28 29 29 return $xactions;
+1 -1
src/applications/maniphest/command/ManiphestCloseEmailCommand.php
··· 24 24 $xactions = array(); 25 25 26 26 $xactions[] = $object->getApplicationTransactionTemplate() 27 - ->setTransactionType(ManiphestTransaction::TYPE_STATUS) 27 + ->setTransactionType(ManiphestTaskStatusTransaction::TRANSACTIONTYPE) 28 28 ->setNewValue(ManiphestTaskStatus::getDefaultClosedStatus()); 29 29 30 30 return $xactions;
+1 -1
src/applications/maniphest/command/ManiphestPriorityEmailCommand.php
··· 71 71 } 72 72 73 73 $xactions[] = $object->getApplicationTransactionTemplate() 74 - ->setTransactionType(ManiphestTransaction::TYPE_PRIORITY) 74 + ->setTransactionType(ManiphestTaskPriorityTransaction::TRANSACTIONTYPE) 75 75 ->setNewValue($priority); 76 76 77 77 return $xactions;
+1 -1
src/applications/maniphest/command/ManiphestStatusEmailCommand.php
··· 73 73 } 74 74 75 75 $xactions[] = $object->getApplicationTransactionTemplate() 76 - ->setTransactionType(ManiphestTransaction::TYPE_STATUS) 76 + ->setTransactionType(ManiphestTaskStatusTransaction::TRANSACTIONTYPE) 77 77 ->setNewValue($status); 78 78 79 79 return $xactions;
+6 -6
src/applications/maniphest/conduit/ManiphestConduitAPIMethod.php
··· 60 60 if ($is_new) { 61 61 $task->setTitle((string)$request->getValue('title')); 62 62 $task->setDescription((string)$request->getValue('description')); 63 - $changes[ManiphestTransaction::TYPE_STATUS] = 63 + $changes[ManiphestTaskStatusTransaction::TRANSACTIONTYPE] = 64 64 ManiphestTaskStatus::getDefaultStatus(); 65 65 $changes[PhabricatorTransactions::TYPE_SUBSCRIBERS] = 66 66 array('+' => array($request->getUser()->getPHID())); ··· 73 73 74 74 $title = $request->getValue('title'); 75 75 if ($title !== null) { 76 - $changes[ManiphestTransaction::TYPE_TITLE] = $title; 76 + $changes[ManiphestTaskTitleTransaction::TRANSACTIONTYPE] = $title; 77 77 } 78 78 79 79 $desc = $request->getValue('description'); 80 80 if ($desc !== null) { 81 - $changes[ManiphestTransaction::TYPE_DESCRIPTION] = $desc; 81 + $changes[ManiphestTaskDescriptionTransaction::TRANSACTIONTYPE] = $desc; 82 82 } 83 83 84 84 $status = $request->getValue('status'); ··· 88 88 throw id(new ConduitException('ERR-INVALID-PARAMETER')) 89 89 ->setErrorDescription(pht('Status set to invalid value.')); 90 90 } 91 - $changes[ManiphestTransaction::TYPE_STATUS] = $status; 91 + $changes[ManiphestTaskStatusTransaction::TRANSACTIONTYPE] = $status; 92 92 } 93 93 } 94 94 ··· 99 99 throw id(new ConduitException('ERR-INVALID-PARAMETER')) 100 100 ->setErrorDescription(pht('Priority set to invalid value.')); 101 101 } 102 - $changes[ManiphestTransaction::TYPE_PRIORITY] = $priority; 102 + $changes[ManiphestTaskPriorityTransaction::TRANSACTIONTYPE] = $priority; 103 103 } 104 104 105 105 $owner_phid = $request->getValue('ownerPHID'); ··· 108 108 array($owner_phid), 109 109 PhabricatorPeopleUserPHIDType::TYPECONST, 110 110 'ownerPHID'); 111 - $changes[ManiphestTransaction::TYPE_OWNER] = $owner_phid; 111 + $changes[ManiphestTaskOwnerTransaction::TRANSACTIONTYPE] = $owner_phid; 112 112 } 113 113 114 114 $ccs = $request->getValue('ccPHIDs');
+1 -1
src/applications/maniphest/controller/ManiphestReportController.php
··· 93 93 ORDER BY x.dateCreated ASC', 94 94 $table->getTableName(), 95 95 $joins, 96 - ManiphestTransaction::TYPE_STATUS); 96 + ManiphestTaskStatusTransaction::TRANSACTIONTYPE); 97 97 98 98 $stats = array(); 99 99 $day_buckets = array();
+2 -2
src/applications/maniphest/controller/ManiphestSubpriorityController.php
··· 43 43 $xactions = array(); 44 44 45 45 $xactions[] = id(new ManiphestTransaction()) 46 - ->setTransactionType(ManiphestTransaction::TYPE_PRIORITY) 46 + ->setTransactionType(ManiphestTaskPriorityTransaction::TRANSACTIONTYPE) 47 47 ->setNewValue($pri); 48 48 49 49 $xactions[] = id(new ManiphestTransaction()) 50 - ->setTransactionType(ManiphestTransaction::TYPE_SUBPRIORITY) 50 + ->setTransactionType(ManiphestTaskSubpriorityTransaction::TRANSACTIONTYPE) 51 51 ->setNewValue($sub); 52 52 53 53 $editor = id(new ManiphestTransactionEditor())
+1 -1
src/applications/maniphest/controller/ManiphestTaskDetailController.php
··· 277 277 $can_create = (bool)$edit_config; 278 278 279 279 $can_reassign = $edit_engine->hasEditAccessToTransaction( 280 - ManiphestTransaction::TYPE_OWNER); 280 + ManiphestTaskOwnerTransaction::TRANSACTIONTYPE); 281 281 282 282 if ($can_create) { 283 283 $form_key = $edit_config->getIdentifier();
+7 -7
src/applications/maniphest/editor/ManiphestEditEngine.php
··· 150 150 ->setConduitDescription(pht('Create as a subtask of another task.')) 151 151 ->setConduitTypeDescription(pht('PHID of the parent task.')) 152 152 ->setAliases(array('parentPHID')) 153 - ->setTransactionType(ManiphestTransaction::TYPE_PARENT) 153 + ->setTransactionType(ManiphestTaskParentTransaction::TRANSACTIONTYPE) 154 154 ->setHandleParameterType(new ManiphestTaskListHTTPParameterType()) 155 155 ->setSingleValue(null) 156 156 ->setIsReorderable(false) ··· 179 179 ->setDescription(pht('Name of the task.')) 180 180 ->setConduitDescription(pht('Rename the task.')) 181 181 ->setConduitTypeDescription(pht('New task name.')) 182 - ->setTransactionType(ManiphestTransaction::TYPE_TITLE) 182 + ->setTransactionType(ManiphestTaskTitleTransaction::TRANSACTIONTYPE) 183 183 ->setIsRequired(true) 184 184 ->setValue($object->getTitle()), 185 185 id(new PhabricatorUsersEditField()) ··· 190 190 ->setConduitDescription(pht('Reassign the task.')) 191 191 ->setConduitTypeDescription( 192 192 pht('New task owner, or `null` to unassign.')) 193 - ->setTransactionType(ManiphestTransaction::TYPE_OWNER) 193 + ->setTransactionType(ManiphestTaskOwnerTransaction::TRANSACTIONTYPE) 194 194 ->setIsCopyable(true) 195 195 ->setSingleValue($object->getOwnerPHID()) 196 196 ->setCommentActionLabel(pht('Assign / Claim')) ··· 201 201 ->setDescription(pht('Status of the task.')) 202 202 ->setConduitDescription(pht('Change the task status.')) 203 203 ->setConduitTypeDescription(pht('New task status constant.')) 204 - ->setTransactionType(ManiphestTransaction::TYPE_STATUS) 204 + ->setTransactionType(ManiphestTaskStatusTransaction::TRANSACTIONTYPE) 205 205 ->setIsCopyable(true) 206 206 ->setValue($object->getStatus()) 207 207 ->setOptions($status_map) ··· 213 213 ->setDescription(pht('Priority of the task.')) 214 214 ->setConduitDescription(pht('Change the priority of the task.')) 215 215 ->setConduitTypeDescription(pht('New task priority constant.')) 216 - ->setTransactionType(ManiphestTransaction::TYPE_PRIORITY) 216 + ->setTransactionType(ManiphestTaskPriorityTransaction::TRANSACTIONTYPE) 217 217 ->setIsCopyable(true) 218 218 ->setValue($object->getPriority()) 219 219 ->setOptions($priority_map) ··· 230 230 ->setDescription(pht('Point value of the task.')) 231 231 ->setConduitDescription(pht('Change the task point value.')) 232 232 ->setConduitTypeDescription(pht('New task point value.')) 233 - ->setTransactionType(ManiphestTransaction::TYPE_POINTS) 233 + ->setTransactionType(ManiphestTaskPointsTransaction::TRANSACTIONTYPE) 234 234 ->setIsCopyable(true) 235 235 ->setValue($object->getPoints()) 236 236 ->setCommentActionLabel($action_label); ··· 242 242 ->setDescription(pht('Task description.')) 243 243 ->setConduitDescription(pht('Update the task description.')) 244 244 ->setConduitTypeDescription(pht('New task description.')) 245 - ->setTransactionType(ManiphestTransaction::TYPE_DESCRIPTION) 245 + ->setTransactionType(ManiphestTaskDescriptionTransaction::TRANSACTIONTYPE) 246 246 ->setValue($object->getDescription()) 247 247 ->setPreviewPanel( 248 248 id(new PHUIRemarkupPreviewPanel())
+21 -324
src/applications/maniphest/editor/ManiphestTransactionEditor.php
··· 18 18 19 19 $types[] = PhabricatorTransactions::TYPE_COMMENT; 20 20 $types[] = PhabricatorTransactions::TYPE_EDGE; 21 - $types[] = ManiphestTransaction::TYPE_PRIORITY; 22 - $types[] = ManiphestTransaction::TYPE_STATUS; 23 - $types[] = ManiphestTransaction::TYPE_TITLE; 24 - $types[] = ManiphestTransaction::TYPE_DESCRIPTION; 25 - $types[] = ManiphestTransaction::TYPE_OWNER; 26 - $types[] = ManiphestTransaction::TYPE_SUBPRIORITY; 27 - $types[] = ManiphestTransaction::TYPE_MERGED_INTO; 28 - $types[] = ManiphestTransaction::TYPE_MERGED_FROM; 29 - $types[] = ManiphestTransaction::TYPE_UNBLOCK; 30 - $types[] = ManiphestTransaction::TYPE_PARENT; 31 - $types[] = ManiphestTransaction::TYPE_COVER_IMAGE; 32 - $types[] = ManiphestTransaction::TYPE_POINTS; 33 21 $types[] = PhabricatorTransactions::TYPE_COLUMNS; 34 22 $types[] = PhabricatorTransactions::TYPE_VIEW_POLICY; 35 23 $types[] = PhabricatorTransactions::TYPE_EDIT_POLICY; ··· 37 25 return $types; 38 26 } 39 27 28 + public function getCreateObjectTitle($author, $object) { 29 + return pht('%s created this task.', $author); 30 + } 31 + 32 + public function getCreateObjectTitleForFeed($author, $object) { 33 + return pht('%s created %s.', $author, $object); 34 + } 35 + 40 36 protected function getCustomTransactionOldValue( 41 37 PhabricatorLiskDAO $object, 42 38 PhabricatorApplicationTransaction $xaction) { 43 39 44 40 switch ($xaction->getTransactionType()) { 45 - case ManiphestTransaction::TYPE_PRIORITY: 46 - if ($this->getIsNewObject()) { 47 - return null; 48 - } 49 - return (int)$object->getPriority(); 50 - case ManiphestTransaction::TYPE_STATUS: 51 - if ($this->getIsNewObject()) { 52 - return null; 53 - } 54 - return $object->getStatus(); 55 - case ManiphestTransaction::TYPE_TITLE: 56 - if ($this->getIsNewObject()) { 57 - return null; 58 - } 59 - return $object->getTitle(); 60 - case ManiphestTransaction::TYPE_DESCRIPTION: 61 - if ($this->getIsNewObject()) { 62 - return null; 63 - } 64 - return $object->getDescription(); 65 - case ManiphestTransaction::TYPE_OWNER: 66 - return nonempty($object->getOwnerPHID(), null); 67 - case ManiphestTransaction::TYPE_SUBPRIORITY: 68 - return $object->getSubpriority(); 69 - case ManiphestTransaction::TYPE_COVER_IMAGE: 70 - return $object->getCoverImageFilePHID(); 71 - case ManiphestTransaction::TYPE_POINTS: 72 - $points = $object->getPoints(); 73 - if ($points !== null) { 74 - $points = (double)$points; 75 - } 76 - return $points; 77 - case ManiphestTransaction::TYPE_MERGED_INTO: 78 - case ManiphestTransaction::TYPE_MERGED_FROM: 79 - return null; 80 - case ManiphestTransaction::TYPE_PARENT: 81 41 case PhabricatorTransactions::TYPE_COLUMNS: 82 42 return null; 83 43 } ··· 88 48 PhabricatorApplicationTransaction $xaction) { 89 49 90 50 switch ($xaction->getTransactionType()) { 91 - case ManiphestTransaction::TYPE_PRIORITY: 92 - return (int)$xaction->getNewValue(); 93 - case ManiphestTransaction::TYPE_OWNER: 94 - return nonempty($xaction->getNewValue(), null); 95 - case ManiphestTransaction::TYPE_STATUS: 96 - case ManiphestTransaction::TYPE_TITLE: 97 - case ManiphestTransaction::TYPE_DESCRIPTION: 98 - case ManiphestTransaction::TYPE_SUBPRIORITY: 99 - case ManiphestTransaction::TYPE_MERGED_INTO: 100 - case ManiphestTransaction::TYPE_MERGED_FROM: 101 - case ManiphestTransaction::TYPE_UNBLOCK: 102 - case ManiphestTransaction::TYPE_COVER_IMAGE: 103 - return $xaction->getNewValue(); 104 - case ManiphestTransaction::TYPE_PARENT: 105 51 case PhabricatorTransactions::TYPE_COLUMNS: 106 52 return $xaction->getNewValue(); 107 - case ManiphestTransaction::TYPE_POINTS: 108 - $value = $xaction->getNewValue(); 109 - if (!strlen($value)) { 110 - $value = null; 111 - } 112 - if ($value !== null) { 113 - $value = (double)$value; 114 - } 115 - return $value; 116 53 } 117 54 } 118 55 ··· 136 73 PhabricatorApplicationTransaction $xaction) { 137 74 138 75 switch ($xaction->getTransactionType()) { 139 - case ManiphestTransaction::TYPE_PRIORITY: 140 - return $object->setPriority($xaction->getNewValue()); 141 - case ManiphestTransaction::TYPE_STATUS: 142 - return $object->setStatus($xaction->getNewValue()); 143 - case ManiphestTransaction::TYPE_TITLE: 144 - return $object->setTitle($xaction->getNewValue()); 145 - case ManiphestTransaction::TYPE_DESCRIPTION: 146 - return $object->setDescription($xaction->getNewValue()); 147 - case ManiphestTransaction::TYPE_OWNER: 148 - $phid = $xaction->getNewValue(); 149 - 150 - // Update the "ownerOrdering" column to contain the full name of the 151 - // owner, if the task is assigned. 152 - 153 - $handle = null; 154 - if ($phid) { 155 - $handle = id(new PhabricatorHandleQuery()) 156 - ->setViewer($this->getActor()) 157 - ->withPHIDs(array($phid)) 158 - ->executeOne(); 159 - } 160 - 161 - if ($handle) { 162 - $object->setOwnerOrdering($handle->getName()); 163 - } else { 164 - $object->setOwnerOrdering(null); 165 - } 166 - 167 - return $object->setOwnerPHID($phid); 168 - case ManiphestTransaction::TYPE_SUBPRIORITY: 169 - $object->setSubpriority($xaction->getNewValue()); 170 - return; 171 - case ManiphestTransaction::TYPE_MERGED_INTO: 172 - $object->setStatus(ManiphestTaskStatus::getDuplicateStatus()); 173 - return; 174 - case ManiphestTransaction::TYPE_COVER_IMAGE: 175 - $file_phid = $xaction->getNewValue(); 176 - 177 - if ($file_phid) { 178 - $file = id(new PhabricatorFileQuery()) 179 - ->setViewer($this->getActor()) 180 - ->withPHIDs(array($file_phid)) 181 - ->executeOne(); 182 - } else { 183 - $file = null; 184 - } 185 - 186 - if (!$file || !$file->isTransformableImage()) { 187 - $object->setProperty('cover.filePHID', null); 188 - $object->setProperty('cover.thumbnailPHID', null); 189 - return; 190 - } 191 - 192 - $xform_key = PhabricatorFileThumbnailTransform::TRANSFORM_WORKCARD; 193 - 194 - $xform = PhabricatorFileTransform::getTransformByKey($xform_key) 195 - ->executeTransform($file); 196 - 197 - $object->setProperty('cover.filePHID', $file->getPHID()); 198 - $object->setProperty('cover.thumbnailPHID', $xform->getPHID()); 199 - return; 200 - case ManiphestTransaction::TYPE_POINTS: 201 - $object->setPoints($xaction->getNewValue()); 202 - return; 203 - case ManiphestTransaction::TYPE_MERGED_FROM: 204 - case ManiphestTransaction::TYPE_PARENT: 205 76 case PhabricatorTransactions::TYPE_COLUMNS: 206 77 return; 207 78 } ··· 212 83 PhabricatorApplicationTransaction $xaction) { 213 84 214 85 switch ($xaction->getTransactionType()) { 215 - case ManiphestTransaction::TYPE_PARENT: 216 - $parent_phid = $xaction->getNewValue(); 217 - $parent_type = ManiphestTaskDependsOnTaskEdgeType::EDGECONST; 218 - $task_phid = $object->getPHID(); 219 - 220 - id(new PhabricatorEdgeEditor()) 221 - ->addEdge($parent_phid, $parent_type, $task_phid) 222 - ->save(); 223 - break; 224 86 case PhabricatorTransactions::TYPE_COLUMNS: 225 87 foreach ($xaction->getNewValue() as $move) { 226 88 $this->applyBoardMove($object, $move); 227 89 } 228 - break; 229 - default: 230 90 break; 231 91 } 232 92 } ··· 240 100 $unblock_xaction = null; 241 101 foreach ($xactions as $xaction) { 242 102 switch ($xaction->getTransactionType()) { 243 - case ManiphestTransaction::TYPE_STATUS: 103 + case ManiphestTaskStatusTransaction::TRANSACTIONTYPE: 244 104 $unblock_xaction = $xaction; 245 105 break; 246 106 } ··· 265 125 266 126 foreach ($blocked_tasks as $blocked_task) { 267 127 $parent_xaction = id(new ManiphestTransaction()) 268 - ->setTransactionType(ManiphestTransaction::TYPE_UNBLOCK) 128 + ->setTransactionType( 129 + ManiphestTaskUnblockTransaction::TRANSACTIONTYPE) 269 130 ->setOldValue(array($object->getPHID() => $old)) 270 131 ->setNewValue(array($object->getPHID() => $new)); 271 132 ··· 398 259 protected function shouldPublishFeedStory( 399 260 PhabricatorLiskDAO $object, 400 261 array $xactions) { 401 - return $this->shouldSendMail($object, $xactions); 262 + return true; 402 263 } 403 264 404 265 protected function supportsSearch() { ··· 426 287 parent::requireCapabilities($object, $xaction); 427 288 428 289 $app_capability_map = array( 429 - ManiphestTransaction::TYPE_PRIORITY => 290 + ManiphestTaskPriorityTransaction::TRANSACTIONTYPE => 430 291 ManiphestEditPriorityCapability::CAPABILITY, 431 - ManiphestTransaction::TYPE_STATUS => 292 + ManiphestTaskStatusTransaction::TRANSACTIONTYPE => 432 293 ManiphestEditStatusCapability::CAPABILITY, 433 - ManiphestTransaction::TYPE_OWNER => 294 + ManiphestTaskOwnerTransaction::TRANSACTIONTYPE => 434 295 ManiphestEditAssignCapability::CAPABILITY, 435 296 PhabricatorTransactions::TYPE_EDIT_POLICY => 436 297 ManiphestEditPoliciesCapability::CAPABILITY, ··· 471 332 $copy = parent::adjustObjectForPolicyChecks($object, $xactions); 472 333 foreach ($xactions as $xaction) { 473 334 switch ($xaction->getTransactionType()) { 474 - case ManiphestTransaction::TYPE_OWNER: 335 + case ManiphestTaskOwnerTransaction::TRANSACTIONTYPE: 475 336 $copy->setOwnerPHID($xaction->getNewValue()); 476 337 break; 477 338 default: ··· 629 490 return array($dst->getPriority(), $sub); 630 491 } 631 492 632 - protected function validateTransaction( 633 - PhabricatorLiskDAO $object, 634 - $type, 635 - array $xactions) { 636 - 637 - $errors = parent::validateTransaction($object, $type, $xactions); 638 - 639 - switch ($type) { 640 - case ManiphestTransaction::TYPE_TITLE: 641 - $missing = $this->validateIsEmptyTextField( 642 - $object->getTitle(), 643 - $xactions); 644 - 645 - if ($missing) { 646 - $error = new PhabricatorApplicationTransactionValidationError( 647 - $type, 648 - pht('Required'), 649 - pht('Task title is required.'), 650 - nonempty(last($xactions), null)); 651 - 652 - $error->setIsMissingFieldError(true); 653 - $errors[] = $error; 654 - } 655 - break; 656 - case ManiphestTransaction::TYPE_PARENT: 657 - $with_effect = array(); 658 - foreach ($xactions as $xaction) { 659 - $task_phid = $xaction->getNewValue(); 660 - if (!$task_phid) { 661 - continue; 662 - } 663 - 664 - $with_effect[] = $xaction; 665 - 666 - $task = id(new ManiphestTaskQuery()) 667 - ->setViewer($this->getActor()) 668 - ->withPHIDs(array($task_phid)) 669 - ->executeOne(); 670 - if (!$task) { 671 - $errors[] = new PhabricatorApplicationTransactionValidationError( 672 - $type, 673 - pht('Invalid'), 674 - pht( 675 - 'Parent task identifier "%s" does not identify a visible '. 676 - 'task.', 677 - $task_phid), 678 - $xaction); 679 - } 680 - } 681 - 682 - if ($with_effect && !$this->getIsNewObject()) { 683 - $errors[] = new PhabricatorApplicationTransactionValidationError( 684 - $type, 685 - pht('Invalid'), 686 - pht( 687 - 'You can only select a parent task when creating a '. 688 - 'transaction for the first time.'), 689 - last($with_effect)); 690 - } 691 - break; 692 - case ManiphestTransaction::TYPE_OWNER: 693 - foreach ($xactions as $xaction) { 694 - $old = $xaction->getOldValue(); 695 - $new = $xaction->getNewValue(); 696 - if (!strlen($new)) { 697 - continue; 698 - } 699 - 700 - if ($new === $old) { 701 - continue; 702 - } 703 - 704 - $assignee_list = id(new PhabricatorPeopleQuery()) 705 - ->setViewer($this->getActor()) 706 - ->withPHIDs(array($new)) 707 - ->execute(); 708 - if (!$assignee_list) { 709 - $errors[] = new PhabricatorApplicationTransactionValidationError( 710 - $type, 711 - pht('Invalid'), 712 - pht( 713 - 'User "%s" is not a valid user.', 714 - $new), 715 - $xaction); 716 - } 717 - } 718 - break; 719 - case ManiphestTransaction::TYPE_COVER_IMAGE: 720 - foreach ($xactions as $xaction) { 721 - $old = $xaction->getOldValue(); 722 - $new = $xaction->getNewValue(); 723 - if (!$new) { 724 - continue; 725 - } 726 - 727 - if ($new === $old) { 728 - continue; 729 - } 730 - 731 - $file = id(new PhabricatorFileQuery()) 732 - ->setViewer($this->getActor()) 733 - ->withPHIDs(array($new)) 734 - ->executeOne(); 735 - if (!$file) { 736 - $errors[] = new PhabricatorApplicationTransactionValidationError( 737 - $type, 738 - pht('Invalid'), 739 - pht('File "%s" is not valid.', $new), 740 - $xaction); 741 - continue; 742 - } 743 - 744 - if (!$file->isTransformableImage()) { 745 - $errors[] = new PhabricatorApplicationTransactionValidationError( 746 - $type, 747 - pht('Invalid'), 748 - pht('File "%s" is not a valid image file.', $new), 749 - $xaction); 750 - continue; 751 - } 752 - } 753 - break; 754 - 755 - case ManiphestTransaction::TYPE_POINTS: 756 - foreach ($xactions as $xaction) { 757 - $new = $xaction->getNewValue(); 758 - if (strlen($new) && !is_numeric($new)) { 759 - $errors[] = new PhabricatorApplicationTransactionValidationError( 760 - $type, 761 - pht('Invalid'), 762 - pht('Points value must be numeric or empty.'), 763 - $xaction); 764 - continue; 765 - } 766 - 767 - if ((double)$new < 0) { 768 - $errors[] = new PhabricatorApplicationTransactionValidationError( 769 - $type, 770 - pht('Invalid'), 771 - pht('Points value must be nonnegative.'), 772 - $xaction); 773 - continue; 774 - } 775 - } 776 - break; 777 - 778 - } 779 - 780 - return $errors; 781 - } 782 - 783 493 protected function validateAllTransactions( 784 494 PhabricatorLiskDAO $object, 785 495 array $xactions) { ··· 806 516 807 517 $any_assign = false; 808 518 foreach ($xactions as $xaction) { 809 - if ($xaction->getTransactionType() == ManiphestTransaction::TYPE_OWNER) { 519 + if ($xaction->getTransactionType() == 520 + ManiphestTaskOwnerTransaction::TRANSACTIONTYPE) { 810 521 $any_assign = true; 811 522 break; 812 523 } ··· 817 528 $new_status = null; 818 529 foreach ($xactions as $xaction) { 819 530 switch ($xaction->getTransactionType()) { 820 - case ManiphestTransaction::TYPE_STATUS: 531 + case ManiphestTaskStatusTransaction::TRANSACTIONTYPE: 821 532 $new_status = $xaction->getNewValue(); 822 533 break; 823 534 } ··· 838 549 // Don't claim the task if the status is configured to not claim. 839 550 if ($actor_phid && $is_claim) { 840 551 $results[] = id(new ManiphestTransaction()) 841 - ->setTransactionType(ManiphestTransaction::TYPE_OWNER) 552 + ->setTransactionType(ManiphestTaskOwnerTransaction::TRANSACTIONTYPE) 842 553 ->setNewValue($actor_phid); 843 554 } 844 555 } ··· 881 592 $this->moreValidationErrors[] = $error; 882 593 } 883 594 break; 884 - case ManiphestTransaction::TYPE_OWNER: 595 + case ManiphestTaskOwnerTransaction::TRANSACTIONTYPE: 885 596 // If this is a no-op update, don't expand it. 886 597 $old_value = $object->getOwnerPHID(); 887 598 $new_value = $xaction->getNewValue(); ··· 904 615 } 905 616 906 617 return $results; 907 - } 908 - 909 - protected function extractFilePHIDsFromCustomTransaction( 910 - PhabricatorLiskDAO $object, 911 - PhabricatorApplicationTransaction $xaction) { 912 - $phids = parent::extractFilePHIDsFromCustomTransaction($object, $xaction); 913 - 914 - switch ($xaction->getTransactionType()) { 915 - case ManiphestTransaction::TYPE_COVER_IMAGE: 916 - $phids[] = $xaction->getNewValue(); 917 - break; 918 - } 919 - 920 - return $phids; 921 618 } 922 619 923 620 private function buildMoveTransaction(
+1 -1
src/applications/maniphest/herald/ManiphestTaskAssignHeraldAction.php
··· 40 40 } 41 41 42 42 $xaction = $adapter->newTransaction() 43 - ->setTransactionType(ManiphestTransaction::TYPE_OWNER) 43 + ->setTransactionType(ManiphestTaskOwnerTransaction::TRANSACTIONTYPE) 44 44 ->setNewValue($phid); 45 45 46 46 $adapter->queueTransaction($xaction);
+1 -1
src/applications/maniphest/herald/ManiphestTaskPriorityHeraldAction.php
··· 40 40 } 41 41 42 42 $xaction = $adapter->newTransaction() 43 - ->setTransactionType(ManiphestTransaction::TYPE_PRIORITY) 43 + ->setTransactionType(ManiphestTaskPriorityTransaction::TRANSACTIONTYPE) 44 44 ->setNewValue($priority); 45 45 46 46 $adapter->queueTransaction($xaction);
+1 -1
src/applications/maniphest/herald/ManiphestTaskStatusHeraldAction.php
··· 40 40 } 41 41 42 42 $xaction = $adapter->newTransaction() 43 - ->setTransactionType(ManiphestTransaction::TYPE_STATUS) 43 + ->setTransactionType(ManiphestTaskStatusTransaction::TRANSACTIONTYPE) 44 44 ->setNewValue($status); 45 45 46 46 $adapter->queueTransaction($xaction);
+5 -5
src/applications/maniphest/lipsum/PhabricatorManiphestTaskTestDataGenerator.php
··· 22 22 $template = new ManiphestTransaction(); 23 23 // Accumulate Transactions 24 24 $changes = array(); 25 - $changes[ManiphestTransaction::TYPE_TITLE] = 25 + $changes[ManiphestTaskTitleTransaction::TRANSACTIONTYPE] = 26 26 $this->generateTitle(); 27 - $changes[ManiphestTransaction::TYPE_DESCRIPTION] = 27 + $changes[ManiphestTaskDescriptionTransaction::TRANSACTIONTYPE] = 28 28 $this->generateDescription(); 29 - $changes[ManiphestTransaction::TYPE_OWNER] = 29 + $changes[ManiphestTaskOwnerTransaction::TRANSACTIONTYPE] = 30 30 $this->loadOwnerPHID(); 31 - $changes[ManiphestTransaction::TYPE_STATUS] = 31 + $changes[ManiphestTaskStatusTransaction::TRANSACTIONTYPE] = 32 32 $this->generateTaskStatus(); 33 - $changes[ManiphestTransaction::TYPE_PRIORITY] = 33 + $changes[ManiphestTaskPriorityTransaction::TRANSACTIONTYPE] = 34 34 $this->generateTaskPriority(); 35 35 $changes[PhabricatorTransactions::TYPE_SUBSCRIBERS] = 36 36 array('=' => $this->getCCPHIDs());
+3 -2
src/applications/maniphest/mail/ManiphestReplyHandler.php
··· 25 25 26 26 if ($is_new) { 27 27 $xactions[] = $this->newTransaction() 28 - ->setTransactionType(ManiphestTransaction::TYPE_TITLE) 28 + ->setTransactionType(ManiphestTaskTitleTransaction::TRANSACTIONTYPE) 29 29 ->setNewValue(nonempty($mail->getSubject(), pht('Untitled Task'))); 30 30 31 31 $xactions[] = $this->newTransaction() 32 - ->setTransactionType(ManiphestTransaction::TYPE_DESCRIPTION) 32 + ->setTransactionType( 33 + ManiphestTaskDescriptionTransaction::TRANSACTIONTYPE) 33 34 ->setNewValue($body); 34 35 35 36 $actor_phid = $actor->getPHID();
+4 -2
src/applications/maniphest/relationship/ManiphestTaskRelationship.php
··· 19 19 protected function newMergeIntoTransactions(ManiphestTask $task) { 20 20 return array( 21 21 id(new ManiphestTransaction()) 22 - ->setTransactionType(ManiphestTransaction::TYPE_MERGED_INTO) 22 + ->setTransactionType( 23 + ManiphestTaskMergedIntoTransaction::TRANSACTIONTYPE) 23 24 ->setNewValue($task->getPHID()), 24 25 ); 25 26 } ··· 34 35 ->setNewValue(array('+' => $subscriber_phids)); 35 36 36 37 $xactions[] = id(new ManiphestTransaction()) 37 - ->setTransactionType(ManiphestTransaction::TYPE_MERGED_FROM) 38 + ->setTransactionType( 39 + ManiphestTaskMergedFromTransaction::TRANSACTIONTYPE) 38 40 ->setNewValue(mpull($tasks, 'getPHID')); 39 41 40 42 return $xactions;
+22 -785
src/applications/maniphest/storage/ManiphestTransaction.php
··· 1 1 <?php 2 2 3 3 final class ManiphestTransaction 4 - extends PhabricatorApplicationTransaction { 5 - 6 - const TYPE_TITLE = 'title'; 7 - const TYPE_STATUS = 'status'; 8 - const TYPE_DESCRIPTION = 'description'; 9 - const TYPE_OWNER = 'reassign'; 10 - const TYPE_PRIORITY = 'priority'; 11 - const TYPE_EDGE = 'edge'; 12 - const TYPE_SUBPRIORITY = 'subpriority'; 13 - const TYPE_MERGED_INTO = 'mergedinto'; 14 - const TYPE_MERGED_FROM = 'mergedfrom'; 15 - const TYPE_UNBLOCK = 'unblock'; 16 - const TYPE_PARENT = 'parent'; 17 - const TYPE_COVER_IMAGE = 'cover-image'; 18 - const TYPE_POINTS = 'points'; 19 - 20 - // NOTE: this type is deprecated. Keep it around for legacy installs 21 - // so any transactions render correctly. 22 - const TYPE_ATTACH = 'attach'; 4 + extends PhabricatorModularTransaction { 23 5 24 6 const MAILTAG_STATUS = 'maniphest-status'; 25 7 const MAILTAG_OWNER = 'maniphest-owner'; ··· 44 26 return new ManiphestTransactionComment(); 45 27 } 46 28 29 + public function getBaseTransactionClass() { 30 + return 'ManiphestTaskTransactionType'; 31 + } 32 + 47 33 public function shouldGenerateOldValue() { 48 34 switch ($this->getTransactionType()) { 49 - case self::TYPE_EDGE: 50 - case self::TYPE_UNBLOCK: 35 + case ManiphestTaskEdgeTransaction::TRANSACTIONTYPE: 36 + case ManiphestTaskUnblockTransaction::TRANSACTIONTYPE: 51 37 return false; 52 38 } 53 39 54 40 return parent::shouldGenerateOldValue(); 55 41 } 56 42 57 - protected function newRemarkupChanges() { 58 - $changes = array(); 59 - 60 - switch ($this->getTransactionType()) { 61 - case self::TYPE_DESCRIPTION: 62 - $changes[] = $this->newRemarkupChange() 63 - ->setOldValue($this->getOldValue()) 64 - ->setNewValue($this->getNewValue()); 65 - break; 66 - } 67 - 68 - return $changes; 69 - } 70 - 71 43 public function getRequiredHandlePHIDs() { 72 44 $phids = parent::getRequiredHandlePHIDs(); 73 45 ··· 75 47 $old = $this->getOldValue(); 76 48 77 49 switch ($this->getTransactionType()) { 78 - case self::TYPE_OWNER: 50 + case ManiphestTaskOwnerTransaction::TRANSACTIONTYPE: 79 51 if ($new) { 80 52 $phids[] = $new; 81 53 } ··· 84 56 $phids[] = $old; 85 57 } 86 58 break; 87 - case self::TYPE_MERGED_INTO: 59 + case ManiphestTaskMergedIntoTransaction::TRANSACTIONTYPE: 88 60 $phids[] = $new; 89 61 break; 90 - case self::TYPE_MERGED_FROM: 62 + case ManiphestTaskMergedFromTransaction::TRANSACTIONTYPE: 91 63 $phids = array_merge($phids, $new); 92 64 break; 93 - case self::TYPE_EDGE: 65 + case ManiphestTaskEdgeTransaction::TRANSACTIONTYPE: 94 66 $phids = array_mergev( 95 67 array( 96 68 $phids, ··· 98 70 array_keys(nonempty($new, array())), 99 71 )); 100 72 break; 101 - case self::TYPE_ATTACH: 73 + case ManiphestTaskAttachTransaction::TRANSACTIONTYPE: 102 74 $old = nonempty($old, array()); 103 75 $new = nonempty($new, array()); 104 76 $phids = array_mergev( ··· 108 80 array_keys(idx($old, 'FILE', array())), 109 81 )); 110 82 break; 111 - case self::TYPE_UNBLOCK: 83 + case ManiphestTaskUnblockTransaction::TRANSACTIONTYPE: 112 84 foreach (array_keys($new) as $phid) { 113 85 $phids[] = $phid; 114 86 } 115 87 break; 116 - case self::TYPE_STATUS: 88 + case ManiphestTaskStatusTransaction::TRANSACTIONTYPE: 117 89 $commit_phid = $this->getMetadataValue('commitPHID'); 118 90 if ($commit_phid) { 119 91 $phids[] = $commit_phid; ··· 124 96 return $phids; 125 97 } 126 98 127 - public function shouldHide() { 128 - switch ($this->getTransactionType()) { 129 - case PhabricatorTransactions::TYPE_EDGE: 130 - $commit_phid = $this->getMetadataValue('commitPHID'); 131 - $edge_type = $this->getMetadataValue('edge:type'); 132 - 133 - if ($edge_type == ManiphestTaskHasCommitEdgeType::EDGECONST) { 134 - if ($commit_phid) { 135 - return true; 136 - } 137 - } 138 - break; 139 - case self::TYPE_DESCRIPTION: 140 - case self::TYPE_PRIORITY: 141 - case self::TYPE_STATUS: 142 - if ($this->getOldValue() === null) { 143 - return true; 144 - } else { 145 - return false; 146 - } 147 - break; 148 - case self::TYPE_SUBPRIORITY: 149 - case self::TYPE_PARENT: 150 - return true; 151 - case self::TYPE_COVER_IMAGE: 152 - // At least for now, don't show these. 153 - return true; 154 - case self::TYPE_POINTS: 155 - if (!ManiphestTaskPoints::getIsEnabled()) { 156 - return true; 157 - } 158 - } 159 - 160 - return parent::shouldHide(); 161 - } 162 - 163 - public function shouldHideForMail(array $xactions) { 164 - switch ($this->getTransactionType()) { 165 - case self::TYPE_POINTS: 166 - return true; 167 - } 168 - 169 - return parent::shouldHideForMail($xactions); 170 - } 171 - 172 - public function shouldHideForFeed() { 173 - switch ($this->getTransactionType()) { 174 - case self::TYPE_UNBLOCK: 175 - // Hide "alice created X, a task blocking Y." from feed because it 176 - // will almost always appear adjacent to "alice created Y". 177 - $is_new = $this->getMetadataValue('blocker.new'); 178 - if ($is_new) { 179 - return true; 180 - } 181 - break; 182 - case self::TYPE_POINTS: 183 - return true; 184 - } 185 - 186 - return parent::shouldHideForFeed(); 187 - } 188 - 189 - public function getActionStrength() { 190 - switch ($this->getTransactionType()) { 191 - case self::TYPE_TITLE: 192 - return 1.4; 193 - case self::TYPE_STATUS: 194 - return 1.3; 195 - case self::TYPE_OWNER: 196 - return 1.2; 197 - case self::TYPE_PRIORITY: 198 - return 1.1; 199 - } 200 - 201 - return parent::getActionStrength(); 202 - } 203 - 204 - 205 - public function getColor() { 206 - $old = $this->getOldValue(); 207 - $new = $this->getNewValue(); 208 - 209 - switch ($this->getTransactionType()) { 210 - case self::TYPE_OWNER: 211 - if ($this->getAuthorPHID() == $new) { 212 - return 'green'; 213 - } else if (!$new) { 214 - return 'black'; 215 - } else if (!$old) { 216 - return 'green'; 217 - } else { 218 - return 'green'; 219 - } 220 - 221 - case self::TYPE_STATUS: 222 - $color = ManiphestTaskStatus::getStatusColor($new); 223 - if ($color !== null) { 224 - return $color; 225 - } 226 - 227 - if (ManiphestTaskStatus::isOpenStatus($new)) { 228 - return 'green'; 229 - } else { 230 - return 'indigo'; 231 - } 232 - 233 - case self::TYPE_PRIORITY: 234 - if ($old == ManiphestTaskPriority::getDefaultPriority()) { 235 - return 'green'; 236 - } else if ($old > $new) { 237 - return 'grey'; 238 - } else { 239 - return 'yellow'; 240 - } 241 - 242 - case self::TYPE_MERGED_FROM: 243 - return 'orange'; 244 - 245 - case self::TYPE_MERGED_INTO: 246 - return 'indigo'; 247 - } 248 - 249 - return parent::getColor(); 250 - } 251 - 252 99 public function getActionName() { 253 100 $old = $this->getOldValue(); 254 101 $new = $this->getNewValue(); 255 - 256 102 switch ($this->getTransactionType()) { 257 - case self::TYPE_TITLE: 258 - if ($old === null) { 259 - return pht('Created'); 260 - } 261 - 262 - return pht('Retitled'); 263 - 264 - case self::TYPE_STATUS: 265 - $action = ManiphestTaskStatus::getStatusActionName($new); 266 - if ($action) { 267 - return $action; 268 - } 269 - 270 - $old_closed = ManiphestTaskStatus::isClosedStatus($old); 271 - $new_closed = ManiphestTaskStatus::isClosedStatus($new); 272 - 273 - if ($new_closed && !$old_closed) { 274 - return pht('Closed'); 275 - } else if (!$new_closed && $old_closed) { 276 - return pht('Reopened'); 277 - } else { 278 - return pht('Changed Status'); 279 - } 280 - 281 - case self::TYPE_DESCRIPTION: 282 - return pht('Edited'); 283 - 284 - case self::TYPE_OWNER: 285 - if ($this->getAuthorPHID() == $new) { 286 - return pht('Claimed'); 287 - } else if (!$new) { 288 - return pht('Unassigned'); 289 - } else if (!$old) { 290 - return pht('Assigned'); 291 - } else { 292 - return pht('Reassigned'); 293 - } 294 - 295 103 case PhabricatorTransactions::TYPE_COLUMNS: 296 104 return pht('Changed Project Column'); 297 - 298 - case self::TYPE_PRIORITY: 299 - if ($old == ManiphestTaskPriority::getDefaultPriority()) { 300 - return pht('Triaged'); 301 - } else if ($old > $new) { 302 - return pht('Lowered Priority'); 303 - } else { 304 - return pht('Raised Priority'); 305 - } 306 - 307 - case self::TYPE_EDGE: 308 - case self::TYPE_ATTACH: 309 - return pht('Attached'); 310 - 311 - case self::TYPE_UNBLOCK: 312 - $old_status = head($old); 313 - $new_status = head($new); 314 - 315 - $old_closed = ManiphestTaskStatus::isClosedStatus($old_status); 316 - $new_closed = ManiphestTaskStatus::isClosedStatus($new_status); 317 - 318 - if ($old_closed && !$new_closed) { 319 - return pht('Block'); 320 - } else if (!$old_closed && $new_closed) { 321 - return pht('Unblock'); 322 - } else { 323 - return pht('Blocker'); 324 - } 325 - 326 - case self::TYPE_MERGED_INTO: 327 - case self::TYPE_MERGED_FROM: 328 - return pht('Merged'); 329 - 330 105 } 331 106 332 107 return parent::getActionName(); 333 108 } 334 109 335 110 public function getIcon() { 336 - $old = $this->getOldValue(); 337 - $new = $this->getNewValue(); 338 - 339 111 switch ($this->getTransactionType()) { 340 - case self::TYPE_OWNER: 341 - return 'fa-user'; 342 - 343 - case self::TYPE_TITLE: 344 - if ($old === null) { 345 - return 'fa-pencil'; 346 - } 347 - 348 - return 'fa-pencil'; 349 - 350 - case self::TYPE_STATUS: 351 - $action = ManiphestTaskStatus::getStatusIcon($new); 352 - if ($action !== null) { 353 - return $action; 354 - } 355 - 356 - if (ManiphestTaskStatus::isClosedStatus($new)) { 357 - return 'fa-check'; 358 - } else { 359 - return 'fa-pencil'; 360 - } 361 - 362 - case self::TYPE_DESCRIPTION: 363 - return 'fa-pencil'; 364 - 365 112 case PhabricatorTransactions::TYPE_COLUMNS: 366 113 return 'fa-columns'; 367 - 368 - case self::TYPE_MERGED_INTO: 369 - return 'fa-check'; 370 - case self::TYPE_MERGED_FROM: 371 - return 'fa-compress'; 372 - 373 - case self::TYPE_PRIORITY: 374 - if ($old == ManiphestTaskPriority::getDefaultPriority()) { 375 - return 'fa-arrow-right'; 376 - } else if ($old > $new) { 377 - return 'fa-arrow-down'; 378 - } else { 379 - return 'fa-arrow-up'; 380 - } 381 - 382 - case self::TYPE_EDGE: 383 - case self::TYPE_ATTACH: 384 - return 'fa-thumb-tack'; 385 - 386 - case self::TYPE_UNBLOCK: 387 - return 'fa-shield'; 388 - 389 114 } 390 115 391 116 return parent::getIcon(); 392 117 } 393 118 394 119 395 - 396 120 public function getTitle() { 397 121 $author_phid = $this->getAuthorPHID(); 398 122 ··· 400 124 $new = $this->getNewValue(); 401 125 402 126 switch ($this->getTransactionType()) { 403 - case PhabricatorTransactions::TYPE_CREATE: 404 - return pht( 405 - '%s created this task.', 406 - $this->renderHandleLink($author_phid)); 407 127 case PhabricatorTransactions::TYPE_SUBTYPE: 408 128 return pht( 409 129 '%s changed the subtype of this task from "%s" to "%s".', 410 130 $this->renderHandleLink($author_phid), 411 131 $this->renderSubtypeName($old), 412 132 $this->renderSubtypeName($new)); 413 - case self::TYPE_TITLE: 414 - if ($old === null) { 415 - return pht( 416 - '%s created this task.', 417 - $this->renderHandleLink($author_phid)); 418 - } 419 - return pht( 420 - '%s changed the title from "%s" to "%s".', 421 - $this->renderHandleLink($author_phid), 422 - $old, 423 - $new); 424 - 425 - case self::TYPE_DESCRIPTION: 426 - return pht( 427 - '%s edited the task description.', 428 - $this->renderHandleLink($author_phid)); 429 - 430 - case self::TYPE_STATUS: 431 - $old_closed = ManiphestTaskStatus::isClosedStatus($old); 432 - $new_closed = ManiphestTaskStatus::isClosedStatus($new); 433 - 434 - $old_name = ManiphestTaskStatus::getTaskStatusName($old); 435 - $new_name = ManiphestTaskStatus::getTaskStatusName($new); 436 - 437 - $commit_phid = $this->getMetadataValue('commitPHID'); 438 - 439 - if ($new_closed && !$old_closed) { 440 - if ($new == ManiphestTaskStatus::getDuplicateStatus()) { 441 - if ($commit_phid) { 442 - return pht( 443 - '%s closed this task as a duplicate by committing %s.', 444 - $this->renderHandleLink($author_phid), 445 - $this->renderHandleLink($commit_phid)); 446 - } else { 447 - return pht( 448 - '%s closed this task as a duplicate.', 449 - $this->renderHandleLink($author_phid)); 450 - } 451 - } else { 452 - if ($commit_phid) { 453 - return pht( 454 - '%s closed this task as "%s" by committing %s.', 455 - $this->renderHandleLink($author_phid), 456 - $new_name, 457 - $this->renderHandleLink($commit_phid)); 458 - } else { 459 - return pht( 460 - '%s closed this task as "%s".', 461 - $this->renderHandleLink($author_phid), 462 - $new_name); 463 - } 464 - } 465 - } else if (!$new_closed && $old_closed) { 466 - if ($commit_phid) { 467 - return pht( 468 - '%s reopened this task as "%s" by committing %s.', 469 - $this->renderHandleLink($author_phid), 470 - $new_name, 471 - $this->renderHandleLink($commit_phid)); 472 - } else { 473 - return pht( 474 - '%s reopened this task as "%s".', 475 - $this->renderHandleLink($author_phid), 476 - $new_name); 477 - } 478 - } else { 479 - if ($commit_phid) { 480 - return pht( 481 - '%s changed the task status from "%s" to "%s" by committing %s.', 482 - $this->renderHandleLink($author_phid), 483 - $old_name, 484 - $new_name, 485 - $this->renderHandleLink($commit_phid)); 486 - } else { 487 - return pht( 488 - '%s changed the task status from "%s" to "%s".', 489 - $this->renderHandleLink($author_phid), 490 - $old_name, 491 - $new_name); 492 - } 493 - } 494 - 495 - case self::TYPE_UNBLOCK: 496 - $blocker_phid = key($new); 497 - $old_status = head($old); 498 - $new_status = head($new); 499 - 500 - $old_closed = ManiphestTaskStatus::isClosedStatus($old_status); 501 - $new_closed = ManiphestTaskStatus::isClosedStatus($new_status); 502 - 503 - $old_name = ManiphestTaskStatus::getTaskStatusName($old_status); 504 - $new_name = ManiphestTaskStatus::getTaskStatusName($new_status); 505 - 506 - if ($this->getMetadataValue('blocker.new')) { 507 - return pht( 508 - '%s created subtask %s.', 509 - $this->renderHandleLink($author_phid), 510 - $this->renderHandleLink($blocker_phid)); 511 - } else if ($old_closed && !$new_closed) { 512 - return pht( 513 - '%s reopened subtask %s as "%s".', 514 - $this->renderHandleLink($author_phid), 515 - $this->renderHandleLink($blocker_phid), 516 - $new_name); 517 - } else if (!$old_closed && $new_closed) { 518 - return pht( 519 - '%s closed subtask %s as "%s".', 520 - $this->renderHandleLink($author_phid), 521 - $this->renderHandleLink($blocker_phid), 522 - $new_name); 523 - } else { 524 - return pht( 525 - '%s changed the status of subtask %s from "%s" to "%s".', 526 - $this->renderHandleLink($author_phid), 527 - $this->renderHandleLink($blocker_phid), 528 - $old_name, 529 - $new_name); 530 - } 531 - 532 - case self::TYPE_OWNER: 533 - if ($author_phid == $new) { 534 - return pht( 535 - '%s claimed this task.', 536 - $this->renderHandleLink($author_phid)); 537 - } else if (!$new) { 538 - return pht( 539 - '%s removed %s as the assignee of this task.', 540 - $this->renderHandleLink($author_phid), 541 - $this->renderHandleLink($old)); 542 - } else if (!$old) { 543 - return pht( 544 - '%s assigned this task to %s.', 545 - $this->renderHandleLink($author_phid), 546 - $this->renderHandleLink($new)); 547 - } else { 548 - return pht( 549 - '%s reassigned this task from %s to %s.', 550 - $this->renderHandleLink($author_phid), 551 - $this->renderHandleLink($old), 552 - $this->renderHandleLink($new)); 553 - } 554 - 555 - case self::TYPE_PRIORITY: 556 - $old_name = ManiphestTaskPriority::getTaskPriorityName($old); 557 - $new_name = ManiphestTaskPriority::getTaskPriorityName($new); 558 - 559 - if ($old == ManiphestTaskPriority::getDefaultPriority()) { 560 - return pht( 561 - '%s triaged this task as "%s" priority.', 562 - $this->renderHandleLink($author_phid), 563 - $new_name); 564 - } else if ($old > $new) { 565 - return pht( 566 - '%s lowered the priority of this task from "%s" to "%s".', 567 - $this->renderHandleLink($author_phid), 568 - $old_name, 569 - $new_name); 570 - } else { 571 - return pht( 572 - '%s raised the priority of this task from "%s" to "%s".', 573 - $this->renderHandleLink($author_phid), 574 - $old_name, 575 - $new_name); 576 - } 577 - 578 - case self::TYPE_ATTACH: 579 - $old = nonempty($old, array()); 580 - $new = nonempty($new, array()); 581 - $new = array_keys(idx($new, 'FILE', array())); 582 - $old = array_keys(idx($old, 'FILE', array())); 583 - 584 - $added = array_diff($new, $old); 585 - $removed = array_diff($old, $new); 586 - if ($added && !$removed) { 587 - return pht( 588 - '%s attached %s file(s): %s.', 589 - $this->renderHandleLink($author_phid), 590 - phutil_count($added), 591 - $this->renderHandleList($added)); 592 - } else if ($removed && !$added) { 593 - return pht( 594 - '%s detached %s file(s): %s.', 595 - $this->renderHandleLink($author_phid), 596 - phutil_count($removed), 597 - $this->renderHandleList($removed)); 598 - } else { 599 - return pht( 600 - '%s changed file(s), attached %s: %s; detached %s: %s.', 601 - $this->renderHandleLink($author_phid), 602 - phutil_count($added), 603 - $this->renderHandleList($added), 604 - phutil_count($removed), 605 - $this->renderHandleList($removed)); 606 - } 607 - 608 - case self::TYPE_MERGED_INTO: 609 - return pht( 610 - '%s closed this task as a duplicate of %s.', 611 - $this->renderHandleLink($author_phid), 612 - $this->renderHandleLink($new)); 613 133 break; 614 - 615 - case self::TYPE_MERGED_FROM: 616 - return pht( 617 - '%s merged %s task(s): %s.', 618 - $this->renderHandleLink($author_phid), 619 - phutil_count($new), 620 - $this->renderHandleList($new)); 621 - break; 622 - 623 - case self::TYPE_POINTS: 624 - if ($old === null) { 625 - return pht( 626 - '%s set the point value for this task to %s.', 627 - $this->renderHandleLink($author_phid), 628 - $new); 629 - } else if ($new === null) { 630 - return pht( 631 - '%s removed the point value for this task.', 632 - $this->renderHandleLink($author_phid)); 633 - } else { 634 - return pht( 635 - '%s changed the point value for this task from %s to %s.', 636 - $this->renderHandleLink($author_phid), 637 - $old, 638 - $new); 639 - } 640 - 641 134 } 642 135 643 136 return parent::getTitle(); ··· 651 144 $new = $this->getNewValue(); 652 145 653 146 switch ($this->getTransactionType()) { 654 - case self::TYPE_TITLE: 655 - if ($old === null) { 656 - return pht( 657 - '%s created %s.', 658 - $this->renderHandleLink($author_phid), 659 - $this->renderHandleLink($object_phid)); 660 - } 661 - 662 - return pht( 663 - '%s renamed %s from "%s" to "%s".', 664 - $this->renderHandleLink($author_phid), 665 - $this->renderHandleLink($object_phid), 666 - $old, 667 - $new); 668 - 669 - case self::TYPE_DESCRIPTION: 670 - return pht( 671 - '%s edited the description of %s.', 672 - $this->renderHandleLink($author_phid), 673 - $this->renderHandleLink($object_phid)); 674 - 675 - case self::TYPE_STATUS: 676 - $old_closed = ManiphestTaskStatus::isClosedStatus($old); 677 - $new_closed = ManiphestTaskStatus::isClosedStatus($new); 678 - 679 - $old_name = ManiphestTaskStatus::getTaskStatusName($old); 680 - $new_name = ManiphestTaskStatus::getTaskStatusName($new); 681 - 682 - $commit_phid = $this->getMetadataValue('commitPHID'); 683 - 684 - if ($new_closed && !$old_closed) { 685 - if ($new == ManiphestTaskStatus::getDuplicateStatus()) { 686 - if ($commit_phid) { 687 - return pht( 688 - '%s closed %s as a duplicate by committing %s.', 689 - $this->renderHandleLink($author_phid), 690 - $this->renderHandleLink($object_phid), 691 - $this->renderHandleLink($commit_phid)); 692 - } else { 693 - return pht( 694 - '%s closed %s as a duplicate.', 695 - $this->renderHandleLink($author_phid), 696 - $this->renderHandleLink($object_phid)); 697 - } 698 - } else { 699 - if ($commit_phid) { 700 - return pht( 701 - '%s closed %s as "%s" by committing %s.', 702 - $this->renderHandleLink($author_phid), 703 - $this->renderHandleLink($object_phid), 704 - $new_name, 705 - $this->renderHandleLink($commit_phid)); 706 - } else { 707 - return pht( 708 - '%s closed %s as "%s".', 709 - $this->renderHandleLink($author_phid), 710 - $this->renderHandleLink($object_phid), 711 - $new_name); 712 - } 713 - } 714 - } else if (!$new_closed && $old_closed) { 715 - if ($commit_phid) { 716 - return pht( 717 - '%s reopened %s as "%s" by committing %s.', 718 - $this->renderHandleLink($author_phid), 719 - $this->renderHandleLink($object_phid), 720 - $new_name, 721 - $this->renderHandleLink($commit_phid)); 722 - } else { 723 - return pht( 724 - '%s reopened %s as "%s".', 725 - $this->renderHandleLink($author_phid), 726 - $this->renderHandleLink($object_phid), 727 - $new_name); 728 - } 729 - } else { 730 - if ($commit_phid) { 731 - return pht( 732 - '%s changed the status of %s from "%s" to "%s" by committing %s.', 733 - $this->renderHandleLink($author_phid), 734 - $this->renderHandleLink($object_phid), 735 - $old_name, 736 - $new_name, 737 - $this->renderHandleLink($commit_phid)); 738 - } else { 739 - return pht( 740 - '%s changed the status of %s from "%s" to "%s".', 741 - $this->renderHandleLink($author_phid), 742 - $this->renderHandleLink($object_phid), 743 - $old_name, 744 - $new_name); 745 - } 746 - } 747 - 748 - case self::TYPE_UNBLOCK: 749 - $blocker_phid = key($new); 750 - $old_status = head($old); 751 - $new_status = head($new); 752 - 753 - $old_closed = ManiphestTaskStatus::isClosedStatus($old_status); 754 - $new_closed = ManiphestTaskStatus::isClosedStatus($new_status); 755 - 756 - $old_name = ManiphestTaskStatus::getTaskStatusName($old_status); 757 - $new_name = ManiphestTaskStatus::getTaskStatusName($new_status); 758 - 759 - if ($old_closed && !$new_closed) { 760 - return pht( 761 - '%s reopened %s, a subtask of %s, as "%s".', 762 - $this->renderHandleLink($author_phid), 763 - $this->renderHandleLink($blocker_phid), 764 - $this->renderHandleLink($object_phid), 765 - $new_name); 766 - } else if (!$old_closed && $new_closed) { 767 - return pht( 768 - '%s closed %s, a subtask of %s, as "%s".', 769 - $this->renderHandleLink($author_phid), 770 - $this->renderHandleLink($blocker_phid), 771 - $this->renderHandleLink($object_phid), 772 - $new_name); 773 - } else { 774 - return pht( 775 - '%s changed the status of %s, a subtask of %s, '. 776 - 'from "%s" to "%s".', 777 - $this->renderHandleLink($author_phid), 778 - $this->renderHandleLink($blocker_phid), 779 - $this->renderHandleLink($object_phid), 780 - $old_name, 781 - $new_name); 782 - } 783 - 784 - case self::TYPE_OWNER: 785 - if ($author_phid == $new) { 786 - return pht( 787 - '%s claimed %s.', 788 - $this->renderHandleLink($author_phid), 789 - $this->renderHandleLink($object_phid)); 790 - } else if (!$new) { 791 - return pht( 792 - '%s placed %s up for grabs.', 793 - $this->renderHandleLink($author_phid), 794 - $this->renderHandleLink($object_phid)); 795 - } else if (!$old) { 796 - return pht( 797 - '%s assigned %s to %s.', 798 - $this->renderHandleLink($author_phid), 799 - $this->renderHandleLink($object_phid), 800 - $this->renderHandleLink($new)); 801 - } else { 802 - return pht( 803 - '%s reassigned %s from %s to %s.', 804 - $this->renderHandleLink($author_phid), 805 - $this->renderHandleLink($object_phid), 806 - $this->renderHandleLink($old), 807 - $this->renderHandleLink($new)); 808 - } 809 - 810 - case self::TYPE_PRIORITY: 811 - $old_name = ManiphestTaskPriority::getTaskPriorityName($old); 812 - $new_name = ManiphestTaskPriority::getTaskPriorityName($new); 813 - 814 - if ($old == ManiphestTaskPriority::getDefaultPriority()) { 815 - return pht( 816 - '%s triaged %s as "%s" priority.', 817 - $this->renderHandleLink($author_phid), 818 - $this->renderHandleLink($object_phid), 819 - $new_name); 820 - } else if ($old > $new) { 821 - return pht( 822 - '%s lowered the priority of %s from "%s" to "%s".', 823 - $this->renderHandleLink($author_phid), 824 - $this->renderHandleLink($object_phid), 825 - $old_name, 826 - $new_name); 827 - } else { 828 - return pht( 829 - '%s raised the priority of %s from "%s" to "%s".', 830 - $this->renderHandleLink($author_phid), 831 - $this->renderHandleLink($object_phid), 832 - $old_name, 833 - $new_name); 834 - } 835 - 836 - case self::TYPE_ATTACH: 837 - $old = nonempty($old, array()); 838 - $new = nonempty($new, array()); 839 - $new = array_keys(idx($new, 'FILE', array())); 840 - $old = array_keys(idx($old, 'FILE', array())); 841 - 842 - $added = array_diff($new, $old); 843 - $removed = array_diff($old, $new); 844 - if ($added && !$removed) { 845 - return pht( 846 - '%s attached %d file(s) of %s: %s', 847 - $this->renderHandleLink($author_phid), 848 - $this->renderHandleLink($object_phid), 849 - count($added), 850 - $this->renderHandleList($added)); 851 - } else if ($removed && !$added) { 852 - return pht( 853 - '%s detached %d file(s) of %s: %s', 854 - $this->renderHandleLink($author_phid), 855 - $this->renderHandleLink($object_phid), 856 - count($removed), 857 - $this->renderHandleList($removed)); 858 - } else { 859 - return pht( 860 - '%s changed file(s) for %s, attached %d: %s; detached %d: %s', 861 - $this->renderHandleLink($author_phid), 862 - $this->renderHandleLink($object_phid), 863 - count($added), 864 - $this->renderHandleList($added), 865 - count($removed), 866 - $this->renderHandleList($removed)); 867 - } 868 - 869 - case self::TYPE_MERGED_INTO: 870 - return pht( 871 - '%s merged task %s into %s.', 872 - $this->renderHandleLink($author_phid), 873 - $this->renderHandleLink($object_phid), 874 - $this->renderHandleLink($new)); 875 - 876 - case self::TYPE_MERGED_FROM: 877 - return pht( 878 - '%s merged %s task(s) %s into %s.', 879 - $this->renderHandleLink($author_phid), 880 - phutil_count($new), 881 - $this->renderHandleList($new), 882 - $this->renderHandleLink($object_phid)); 883 - 884 147 case PhabricatorTransactions::TYPE_SUBTYPE: 885 148 return pht( 886 149 '%s changed the subtype of %s from "%s" to "%s".', ··· 893 156 return parent::getTitleForFeed(); 894 157 } 895 158 896 - private function renderSubtypeName($value) { 897 - $object = $this->getObject(); 898 - $map = $object->newEditEngineSubtypeMap(); 899 - if (!isset($map[$value])) { 900 - return $value; 901 - } 902 - 903 - return $map[$value]->getName(); 904 - } 905 - 906 - public function hasChangeDetails() { 907 - switch ($this->getTransactionType()) { 908 - case self::TYPE_DESCRIPTION: 909 - return true; 910 - } 911 - return parent::hasChangeDetails(); 912 - } 913 - 914 - public function renderChangeDetails(PhabricatorUser $viewer) { 915 - return $this->renderTextCorpusChangeDetails( 916 - $viewer, 917 - $this->getOldValue(), 918 - $this->getNewValue()); 919 - } 920 - 921 159 public function getMailTags() { 922 160 $tags = array(); 923 161 switch ($this->getTransactionType()) { 924 - case self::TYPE_MERGED_INTO: 925 - case self::TYPE_STATUS: 162 + case ManiphestTaskMergedIntoTransaction::TRANSACTIONTYPE: 163 + case ManiphestTaskStatusTransaction::TRANSACTIONTYPE: 926 164 $tags[] = self::MAILTAG_STATUS; 927 165 break; 928 - case self::TYPE_OWNER: 166 + case ManiphestTaskOwnerTransaction::TRANSACTIONTYPE: 929 167 $tags[] = self::MAILTAG_OWNER; 930 168 break; 931 169 case PhabricatorTransactions::TYPE_SUBSCRIBERS: ··· 941 179 break; 942 180 } 943 181 break; 944 - case self::TYPE_PRIORITY: 182 + case ManiphestTaskPriorityTransaction::TRANSACTIONTYPE: 945 183 $tags[] = self::MAILTAG_PRIORITY; 946 184 break; 947 - case self::TYPE_UNBLOCK: 185 + case ManiphestTaskUnblockTransaction::TRANSACTIONTYPE: 948 186 $tags[] = self::MAILTAG_UNBLOCK; 949 187 break; 950 188 case PhabricatorTransactions::TYPE_COLUMNS: ··· 961 199 } 962 200 963 201 public function getNoEffectDescription() { 964 - 965 202 switch ($this->getTransactionType()) { 966 - case self::TYPE_STATUS: 203 + case ManiphestTaskStatusTransaction::TRANSACTIONTYPE: 967 204 return pht('The task already has the selected status.'); 968 - case self::TYPE_OWNER: 205 + case ManiphestTaskOwnerTransaction::TRANSACTIONTYPE: 969 206 return pht('The task already has the selected owner.'); 970 - case self::TYPE_PRIORITY: 207 + case ManiphestTaskPriorityTransaction::TRANSACTIONTYPE: 971 208 return pht('The task already has the selected priority.'); 972 209 } 973 210
+91
src/applications/maniphest/xaction/ManiphestTaskAttachTransaction.php
··· 1 + <?php 2 + 3 + final class ManiphestTaskAttachTransaction 4 + extends ManiphestTaskTransactionType { 5 + 6 + // NOTE: this type is deprecated. Keep it around for legacy installs 7 + // so any transactions render correctly. 8 + 9 + const TRANSACTIONTYPE = 'attach'; 10 + 11 + public function getActionName() { 12 + return pht('Attached'); 13 + } 14 + 15 + public function getTitle() { 16 + $old = $this->getOldValue(); 17 + $new = $this->getNewValue(); 18 + 19 + $old = nonempty($old, array()); 20 + $new = nonempty($new, array()); 21 + $new = array_keys(idx($new, 'FILE', array())); 22 + $old = array_keys(idx($old, 'FILE', array())); 23 + 24 + $added = array_diff($new, $old); 25 + $removed = array_diff($old, $new); 26 + if ($added && !$removed) { 27 + return pht( 28 + '%s attached %s file(s): %s.', 29 + $this->renderAuthor(), 30 + phutil_count($added), 31 + $this->renderHandleList($added)); 32 + } else if ($removed && !$added) { 33 + return pht( 34 + '%s detached %s file(s): %s.', 35 + $this->renderAuthor(), 36 + phutil_count($removed), 37 + $this->renderHandleList($removed)); 38 + } else { 39 + return pht( 40 + '%s changed file(s), attached %s: %s; detached %s: %s.', 41 + $this->renderAuthor(), 42 + phutil_count($added), 43 + $this->renderHandleList($added), 44 + phutil_count($removed), 45 + $this->renderHandleList($removed)); 46 + } 47 + 48 + } 49 + 50 + public function getTitleForFeed() { 51 + $old = $this->getOldValue(); 52 + $new = $this->getNewValue(); 53 + 54 + $old = nonempty($old, array()); 55 + $new = nonempty($new, array()); 56 + $new = array_keys(idx($new, 'FILE', array())); 57 + $old = array_keys(idx($old, 'FILE', array())); 58 + 59 + $added = array_diff($new, $old); 60 + $removed = array_diff($old, $new); 61 + if ($added && !$removed) { 62 + return pht( 63 + '%s attached %d file(s) of %s: %s', 64 + $this->renderAuthor(), 65 + $this->renderObject(), 66 + count($added), 67 + $this->renderHandleList($added)); 68 + } else if ($removed && !$added) { 69 + return pht( 70 + '%s detached %d file(s) of %s: %s', 71 + $this->renderAuthor(), 72 + $this->renderObject(), 73 + count($removed), 74 + $this->renderHandleList($removed)); 75 + } else { 76 + return pht( 77 + '%s changed file(s) for %s, attached %d: %s; detached %d: %s', 78 + $this->renderAuthor(), 79 + $this->renderObject(), 80 + count($added), 81 + $this->renderHandleList($added), 82 + count($removed), 83 + $this->renderHandleList($removed)); 84 + } 85 + } 86 + 87 + public function getIcon() { 88 + return 'fa-thumb-tack'; 89 + } 90 + 91 + }
+106
src/applications/maniphest/xaction/ManiphestTaskCoverImageTransaction.php
··· 1 + <?php 2 + 3 + final class ManiphestTaskCoverImageTransaction 4 + extends ManiphestTaskTransactionType { 5 + 6 + const TRANSACTIONTYPE = 'cover-image'; 7 + 8 + public function generateOldValue($object) { 9 + return $object->getCoverImageFilePHID(); 10 + } 11 + 12 + public function applyInternalEffects($object, $value) { 13 + $file_phid = $value; 14 + 15 + if ($file_phid) { 16 + $file = id(new PhabricatorFileQuery()) 17 + ->setViewer($this->getActor()) 18 + ->withPHIDs(array($file_phid)) 19 + ->executeOne(); 20 + } else { 21 + $file = null; 22 + } 23 + 24 + if (!$file || !$file->isTransformableImage()) { 25 + $object->setProperty('cover.filePHID', null); 26 + $object->setProperty('cover.thumbnailPHID', null); 27 + return; 28 + } 29 + 30 + $xform_key = PhabricatorFileThumbnailTransform::TRANSFORM_WORKCARD; 31 + $xform = PhabricatorFileTransform::getTransformByKey($xform_key) 32 + ->executeTransform($file); 33 + 34 + $object->setProperty('cover.filePHID', $file->getPHID()); 35 + $object->setProperty('cover.thumbnailPHID', $xform->getPHID()); 36 + } 37 + 38 + public function getTitle() { 39 + $old = $this->getOldValue(); 40 + $new = $this->getNewValue(); 41 + 42 + if ($old === null) { 43 + return pht( 44 + '%s set the cover image to %s.', 45 + $this->renderAuthor(), 46 + $this->renderHandle($new)); 47 + } 48 + 49 + return pht( 50 + '%s updated the cover image to %s.', 51 + $this->renderAuthor(), 52 + $this->renderHandle($new)); 53 + 54 + } 55 + 56 + public function getTitleForFeed() { 57 + $old = $this->getOldValue(); 58 + if ($old === null) { 59 + return pht( 60 + '%s added a cover image to %s.', 61 + $this->renderAuthor(), 62 + $this->renderObject()); 63 + } 64 + 65 + return pht( 66 + '%s updated the cover image for %s.', 67 + $this->renderAuthor(), 68 + $this->renderObject()); 69 + } 70 + 71 + public function validateTransactions($object, array $xactions) { 72 + $errors = array(); 73 + $viewer = $this->getActor(); 74 + 75 + foreach ($xactions as $xaction) { 76 + $file_phid = $xaction->getNewValue(); 77 + 78 + $file = id(new PhabricatorFileQuery()) 79 + ->setViewer($viewer) 80 + ->withPHIDs(array($file_phid)) 81 + ->executeOne(); 82 + 83 + if (!$file) { 84 + $errors[] = $this->newInvalidError( 85 + pht('"%s" is not a valid file PHID.', 86 + $file_phid)); 87 + } else { 88 + if (!$file->isViewableImage()) { 89 + $mime_type = $file->getMimeType(); 90 + $errors[] = $this->newInvalidError( 91 + pht('File mime type of "%s" is not a valid viewable image.', 92 + $mime_type)); 93 + } 94 + } 95 + 96 + } 97 + 98 + return $errors; 99 + } 100 + 101 + public function getIcon() { 102 + return 'fa-image'; 103 + } 104 + 105 + 106 + }
+61
src/applications/maniphest/xaction/ManiphestTaskDescriptionTransaction.php
··· 1 + <?php 2 + 3 + final class ManiphestTaskDescriptionTransaction 4 + extends ManiphestTaskTransactionType { 5 + 6 + const TRANSACTIONTYPE = 'description'; 7 + 8 + public function generateOldValue($object) { 9 + return $object->getDescription(); 10 + } 11 + 12 + public function applyInternalEffects($object, $value) { 13 + $object->setDescription($value); 14 + } 15 + 16 + public function getActionName() { 17 + return pht('Edited'); 18 + } 19 + 20 + public function getTitle() { 21 + return pht( 22 + '%s updated the task description.', 23 + $this->renderAuthor()); 24 + } 25 + 26 + public function getTitleForFeed() { 27 + return pht( 28 + '%s updated the task description for %s.', 29 + $this->renderAuthor(), 30 + $this->renderObject()); 31 + } 32 + 33 + public function hasChangeDetailView() { 34 + return true; 35 + } 36 + 37 + public function getMailDiffSectionHeader() { 38 + return pht('CHANGES TO TASK DESCRIPTION'); 39 + } 40 + 41 + public function newChangeDetailView() { 42 + $viewer = $this->getViewer(); 43 + 44 + return id(new PhabricatorApplicationTransactionTextDiffDetailView()) 45 + ->setViewer($viewer) 46 + ->setOldText($this->getOldValue()) 47 + ->setNewText($this->getNewValue()); 48 + } 49 + 50 + public function newRemarkupChanges() { 51 + $changes = array(); 52 + 53 + $changes[] = $this->newRemarkupChange() 54 + ->setOldValue($this->getOldValue()) 55 + ->setNewValue($this->getNewValue()); 56 + 57 + return $changes; 58 + } 59 + 60 + 61 + }
+31
src/applications/maniphest/xaction/ManiphestTaskEdgeTransaction.php
··· 1 + <?php 2 + 3 + final class ManiphestTaskEdgeTransaction 4 + extends ManiphestTaskTransactionType { 5 + 6 + const TRANSACTIONTYPE = 'edge'; 7 + 8 + public function generateOldValue($object) { 9 + return null; 10 + } 11 + 12 + public function shouldHide() { 13 + $commit_phid = $this->getMetadataValue('commitPHID'); 14 + $edge_type = $this->getMetadataValue('edge:type'); 15 + 16 + if ($edge_type == ManiphestTaskHasCommitEdgeType::EDGECONST) { 17 + if ($commit_phid) { 18 + return true; 19 + } 20 + } 21 + } 22 + 23 + public function getActionName() { 24 + return pht('Attached'); 25 + } 26 + 27 + public function getIcon() { 28 + return 'fa-thumb-tack'; 29 + } 30 + 31 + }
+45
src/applications/maniphest/xaction/ManiphestTaskMergedFromTransaction.php
··· 1 + <?php 2 + 3 + final class ManiphestTaskMergedFromTransaction 4 + extends ManiphestTaskTransactionType { 5 + 6 + const TRANSACTIONTYPE = 'mergedfrom'; 7 + 8 + public function generateOldValue($object) { 9 + return null; 10 + } 11 + 12 + public function getActionName() { 13 + return pht('Merged'); 14 + } 15 + 16 + public function getTitle() { 17 + $new = $this->getNewValue(); 18 + 19 + return pht( 20 + '%s merged %s task(s): %s.', 21 + $this->renderAuthor(), 22 + phutil_count($new), 23 + $this->renderHandleList($new)); 24 + } 25 + 26 + public function getTitleForFeed() { 27 + $new = $this->getNewValue(); 28 + 29 + return pht( 30 + '%s merged %s task(s) %s into %s.', 31 + $this->renderAuthor(), 32 + phutil_count($new), 33 + $this->renderHandleList($new), 34 + $this->renderObject()); 35 + } 36 + 37 + public function getIcon() { 38 + return 'fa-compress'; 39 + } 40 + 41 + public function getColor() { 42 + return 'orange'; 43 + } 44 + 45 + }
+47
src/applications/maniphest/xaction/ManiphestTaskMergedIntoTransaction.php
··· 1 + <?php 2 + 3 + final class ManiphestTaskMergedIntoTransaction 4 + extends ManiphestTaskTransactionType { 5 + 6 + const TRANSACTIONTYPE = 'mergedinto'; 7 + 8 + public function generateOldValue($object) { 9 + return null; 10 + } 11 + 12 + public function applyInternalEffects($object, $value) { 13 + $object->setStatus(ManiphestTaskStatus::getDuplicateStatus()); 14 + } 15 + 16 + public function getActionName() { 17 + return pht('Merged'); 18 + } 19 + 20 + public function getTitle() { 21 + $new = $this->getNewValue(); 22 + 23 + return pht( 24 + '%s closed this task as a duplicate of %s.', 25 + $this->renderAuthor(), 26 + $this->renderHandle($new)); 27 + } 28 + 29 + public function getTitleForFeed() { 30 + $new = $this->getNewValue(); 31 + 32 + return pht( 33 + '%s merged task %s into %s.', 34 + $this->renderAuthor(), 35 + $this->renderObject(), 36 + $this->renderHandle($new)); 37 + } 38 + 39 + public function getIcon() { 40 + return 'fa-check'; 41 + } 42 + 43 + public function getColor() { 44 + return 'indigo'; 45 + } 46 + 47 + }
+158
src/applications/maniphest/xaction/ManiphestTaskOwnerTransaction.php
··· 1 + <?php 2 + 3 + final class ManiphestTaskOwnerTransaction 4 + extends ManiphestTaskTransactionType { 5 + 6 + const TRANSACTIONTYPE = 'reassign'; 7 + 8 + public function generateOldValue($object) { 9 + return nonempty($object->getOwnerPHID(), null); 10 + } 11 + 12 + public function applyInternalEffects($object, $value) { 13 + // Update the "ownerOrdering" column to contain the full name of the 14 + // owner, if the task is assigned. 15 + 16 + $handle = null; 17 + if ($value) { 18 + $handle = id(new PhabricatorHandleQuery()) 19 + ->setViewer($this->getActor()) 20 + ->withPHIDs(array($value)) 21 + ->executeOne(); 22 + } 23 + 24 + if ($handle) { 25 + $object->setOwnerOrdering($handle->getName()); 26 + } else { 27 + $object->setOwnerOrdering(null); 28 + } 29 + 30 + $object->setOwnerPHID($value); 31 + } 32 + 33 + public function getActionStrength() { 34 + return 1.2; 35 + } 36 + 37 + public function getActionName() { 38 + $old = $this->getOldValue(); 39 + $new = $this->getNewValue(); 40 + 41 + if ($this->getAuthorPHID() == $new) { 42 + return pht('Claimed'); 43 + } else if (!$new) { 44 + return pht('Unassigned'); 45 + } else if (!$old) { 46 + return pht('Assigned'); 47 + } else { 48 + return pht('Reassigned'); 49 + } 50 + } 51 + 52 + public function getTitle() { 53 + $old = $this->getOldValue(); 54 + $new = $this->getNewValue(); 55 + 56 + if ($this->getAuthorPHID() == $new) { 57 + return pht( 58 + '%s claimed this task.', 59 + $this->renderAuthor()); 60 + } else if (!$new) { 61 + return pht( 62 + '%s removed %s as the assignee of this task.', 63 + $this->renderAuthor(), 64 + $this->renderHandle($old)); 65 + } else if (!$old) { 66 + return pht( 67 + '%s assigned this task to %s.', 68 + $this->renderAuthor(), 69 + $this->renderHandle($new)); 70 + } else { 71 + return pht( 72 + '%s reassigned this task from %s to %s.', 73 + $this->renderAuthor(), 74 + $this->renderHandle($old), 75 + $this->renderHandle($new)); 76 + } 77 + } 78 + 79 + public function getTitleForFeed() { 80 + $old = $this->getOldValue(); 81 + $new = $this->getNewValue(); 82 + 83 + if ($this->getAuthorPHID() == $new) { 84 + return pht( 85 + '%s claimed %s.', 86 + $this->renderAuthor(), 87 + $this->renderObject()); 88 + } else if (!$new) { 89 + return pht( 90 + '%s placed %s up for grabs.', 91 + $this->renderAuthor(), 92 + $this->renderObject()); 93 + } else if (!$old) { 94 + return pht( 95 + '%s assigned %s to %s.', 96 + $this->renderAuthor(), 97 + $this->renderObject(), 98 + $this->renderHandle($new)); 99 + } else { 100 + return pht( 101 + '%s reassigned %s from %s to %s.', 102 + $this->renderAuthor(), 103 + $this->renderObject(), 104 + $this->renderHandle($old), 105 + $this->renderHandle($new)); 106 + } 107 + } 108 + 109 + public function validateTransactions($object, array $xactions) { 110 + $errors = array(); 111 + 112 + foreach ($xactions as $xaction) { 113 + $old = $xaction->getOldValue(); 114 + $new = $xaction->getNewValue(); 115 + if (!strlen($new)) { 116 + continue; 117 + } 118 + 119 + if ($new === $old) { 120 + continue; 121 + } 122 + 123 + $assignee_list = id(new PhabricatorPeopleQuery()) 124 + ->setViewer($this->getActor()) 125 + ->withPHIDs(array($new)) 126 + ->execute(); 127 + 128 + if (!$assignee_list) { 129 + $errors[] = $this->newInvalidError( 130 + pht('User "%s" is not a valid user.', 131 + $new)); 132 + } 133 + } 134 + return $errors; 135 + } 136 + 137 + public function getIcon() { 138 + return 'fa-user'; 139 + } 140 + 141 + public function getColor() { 142 + $old = $this->getOldValue(); 143 + $new = $this->getNewValue(); 144 + 145 + if ($this->getAuthorPHID() == $new) { 146 + return 'green'; 147 + } else if (!$new) { 148 + return 'black'; 149 + } else if (!$old) { 150 + return 'green'; 151 + } else { 152 + return 'green'; 153 + } 154 + 155 + } 156 + 157 + 158 + }
+60
src/applications/maniphest/xaction/ManiphestTaskParentTransaction.php
··· 1 + <?php 2 + 3 + final class ManiphestTaskParentTransaction 4 + extends ManiphestTaskTransactionType { 5 + 6 + const TRANSACTIONTYPE = 'parent'; 7 + 8 + public function generateOldValue($object) { 9 + return null; 10 + } 11 + 12 + public function shouldHide() { 13 + return true; 14 + } 15 + 16 + public function applyExternalEffects($object, $value) { 17 + $parent_phid = $value; 18 + $parent_type = ManiphestTaskDependsOnTaskEdgeType::EDGECONST; 19 + $task_phid = $object->getPHID(); 20 + 21 + id(new PhabricatorEdgeEditor()) 22 + ->addEdge($parent_phid, $parent_type, $task_phid) 23 + ->save(); 24 + } 25 + 26 + public function validateTransactions($object, array $xactions) { 27 + $errors = array(); 28 + 29 + $with_effect = array(); 30 + foreach ($xactions as $xaction) { 31 + $task_phid = $xaction->getNewValue(); 32 + if (!$task_phid) { 33 + continue; 34 + } 35 + 36 + $with_effect[] = $xaction; 37 + 38 + $task = id(new ManiphestTaskQuery()) 39 + ->setViewer($this->getActor()) 40 + ->withPHIDs(array($task_phid)) 41 + ->executeOne(); 42 + if (!$task) { 43 + $errors[] = $this->newInvalidError( 44 + pht( 45 + 'Parent task identifier "%s" does not identify a visible '. 46 + 'task.', 47 + $task_phid)); 48 + } 49 + } 50 + 51 + if ($with_effect && !$this->isNewObject()) { 52 + $errors[] = $this->newInvalidError( 53 + pht( 54 + 'You can only select a parent task when creating a '. 55 + 'transaction for the first time.')); 56 + } 57 + 58 + return $errors; 59 + } 60 + }
+76
src/applications/maniphest/xaction/ManiphestTaskPointsTransaction.php
··· 1 + <?php 2 + 3 + final class ManiphestTaskPointsTransaction 4 + extends ManiphestTaskTransactionType { 5 + 6 + const TRANSACTIONTYPE = 'points'; 7 + 8 + public function generateOldValue($object) { 9 + return $object->getPoints(); 10 + } 11 + 12 + public function applyInternalEffects($object, $value) { 13 + if (!strlen($value)) { 14 + $value = null; 15 + } 16 + if ($value !== null) { 17 + $value = (double)$value; 18 + } 19 + $object->setPoints($value); 20 + } 21 + 22 + public function shouldHideForFeed() { 23 + return true; 24 + } 25 + 26 + public function shouldHide() { 27 + if (!ManiphestTaskPoints::getIsEnabled()) { 28 + return true; 29 + } 30 + return false; 31 + } 32 + 33 + public function getTitle() { 34 + $old = $this->getOldValue(); 35 + $new = $this->getNewValue(); 36 + 37 + if ($old === null) { 38 + return pht( 39 + '%s set the point value for this task to %s.', 40 + $this->renderAuthor(), 41 + $this->renderNewValue()); 42 + } else if ($new === null) { 43 + return pht( 44 + '%s removed the point value for this task.', 45 + $this->renderAuthor()); 46 + } else { 47 + return pht( 48 + '%s changed the point value for this task from %s to %s.', 49 + $this->renderAuthor(), 50 + $this->renderOldValue(), 51 + $this->renderNewValue()); 52 + } 53 + } 54 + 55 + public function validateTransactions($object, array $xactions) { 56 + $errors = array(); 57 + 58 + foreach ($xactions as $xaction) { 59 + $new = $xaction->getNewValue(); 60 + if (strlen($new) && !is_numeric($new)) { 61 + $errors[] = $this->newInvalidError( 62 + pht('Points value must be numeric or empty.')); 63 + continue; 64 + } 65 + 66 + if ((double)$new < 0) { 67 + $errors[] = $this->newInvalidError( 68 + pht('Points value must be nonnegative.')); 69 + continue; 70 + } 71 + } 72 + 73 + return $errors; 74 + } 75 + 76 + }
+119
src/applications/maniphest/xaction/ManiphestTaskPriorityTransaction.php
··· 1 + <?php 2 + 3 + final class ManiphestTaskPriorityTransaction 4 + extends ManiphestTaskTransactionType { 5 + 6 + const TRANSACTIONTYPE = 'priority'; 7 + 8 + public function generateOldValue($object) { 9 + if ($this->isNewObject()) { 10 + return null; 11 + } 12 + return $object->getPriority(); 13 + } 14 + 15 + public function applyInternalEffects($object, $value) { 16 + $object->setPriority($value); 17 + } 18 + 19 + public function getActionStrength() { 20 + return 1.1; 21 + } 22 + 23 + public function getActionName() { 24 + $old = $this->getOldValue(); 25 + $new = $this->getNewValue(); 26 + 27 + if ($old == ManiphestTaskPriority::getDefaultPriority()) { 28 + return pht('Triaged'); 29 + } else if ($old > $new) { 30 + return pht('Lowered Priority'); 31 + } else { 32 + return pht('Raised Priority'); 33 + } 34 + } 35 + 36 + public function getTitle() { 37 + $old = $this->getOldValue(); 38 + $new = $this->getNewValue(); 39 + 40 + $old_name = ManiphestTaskPriority::getTaskPriorityName($old); 41 + $new_name = ManiphestTaskPriority::getTaskPriorityName($new); 42 + 43 + if ($old == ManiphestTaskPriority::getDefaultPriority()) { 44 + return pht( 45 + '%s triaged this task as %s priority.', 46 + $this->renderAuthor(), 47 + $this->renderValue($new_name)); 48 + } else if ($old > $new) { 49 + return pht( 50 + '%s lowered the priority of this task from %s to %s.', 51 + $this->renderAuthor(), 52 + $this->renderValue($old_name), 53 + $this->renderValue($new_name)); 54 + } else { 55 + return pht( 56 + '%s raised the priority of this task from %s to %s.', 57 + $this->renderAuthor(), 58 + $this->renderValue($old_name), 59 + $this->renderValue($new_name)); 60 + } 61 + } 62 + 63 + public function getTitleForFeed() { 64 + $old = $this->getOldValue(); 65 + $new = $this->getNewValue(); 66 + 67 + $old_name = ManiphestTaskPriority::getTaskPriorityName($old); 68 + $new_name = ManiphestTaskPriority::getTaskPriorityName($new); 69 + 70 + if ($old == ManiphestTaskPriority::getDefaultPriority()) { 71 + return pht( 72 + '%s triaged %s as %s priority.', 73 + $this->renderAuthor(), 74 + $this->renderObject(), 75 + $this->renderValue($new_name)); 76 + } else if ($old > $new) { 77 + return pht( 78 + '%s lowered the priority of %s from %s to %s.', 79 + $this->renderAuthor(), 80 + $this->renderObject(), 81 + $this->renderValue($old_name), 82 + $this->renderValue($new_name)); 83 + } else { 84 + return pht( 85 + '%s raised the priority of %s from %s to %s.', 86 + $this->renderAuthor(), 87 + $this->renderObject(), 88 + $this->renderValue($old_name), 89 + $this->renderValue($new_name)); 90 + } 91 + } 92 + 93 + public function getIcon() { 94 + $old = $this->getOldValue(); 95 + $new = $this->getNewValue(); 96 + 97 + if ($old == ManiphestTaskPriority::getDefaultPriority()) { 98 + return 'fa-arrow-right'; 99 + } else if ($old > $new) { 100 + return 'fa-arrow-down'; 101 + } else { 102 + return 'fa-arrow-up'; 103 + } 104 + } 105 + 106 + public function getColor() { 107 + $old = $this->getOldValue(); 108 + $new = $this->getNewValue(); 109 + 110 + if ($old == ManiphestTaskPriority::getDefaultPriority()) { 111 + return 'green'; 112 + } else if ($old > $new) { 113 + return 'grey'; 114 + } else { 115 + return 'yellow'; 116 + } 117 + } 118 + 119 + }
+232
src/applications/maniphest/xaction/ManiphestTaskStatusTransaction.php
··· 1 + <?php 2 + 3 + final class ManiphestTaskStatusTransaction 4 + extends ManiphestTaskTransactionType { 5 + 6 + const TRANSACTIONTYPE = 'status'; 7 + 8 + public function generateOldValue($object) { 9 + if ($this->isNewObject()) { 10 + return null; 11 + } 12 + return $object->getStatus(); 13 + } 14 + 15 + public function applyInternalEffects($object, $value) { 16 + $object->setStatus($value); 17 + } 18 + 19 + public function shouldHide() { 20 + if ($this->getOldValue() === null) { 21 + return true; 22 + } else { 23 + return false; 24 + } 25 + } 26 + 27 + public function getActionStrength() { 28 + return 1.3; 29 + } 30 + 31 + public function getActionName() { 32 + $old = $this->getOldValue(); 33 + $new = $this->getNewValue(); 34 + 35 + $action = ManiphestTaskStatus::getStatusActionName($new); 36 + if ($action) { 37 + return $action; 38 + } 39 + 40 + $old_closed = ManiphestTaskStatus::isClosedStatus($old); 41 + $new_closed = ManiphestTaskStatus::isClosedStatus($new); 42 + 43 + if ($new_closed && !$old_closed) { 44 + return pht('Closed'); 45 + } else if (!$new_closed && $old_closed) { 46 + return pht('Reopened'); 47 + } else { 48 + return pht('Changed Status'); 49 + } 50 + } 51 + 52 + public function getTitle() { 53 + $old = $this->getOldValue(); 54 + $new = $this->getNewValue(); 55 + 56 + $old_closed = ManiphestTaskStatus::isClosedStatus($old); 57 + $new_closed = ManiphestTaskStatus::isClosedStatus($new); 58 + 59 + $old_name = ManiphestTaskStatus::getTaskStatusName($old); 60 + $new_name = ManiphestTaskStatus::getTaskStatusName($new); 61 + 62 + $commit_phid = $this->getMetadataValue('commitPHID'); 63 + 64 + if ($new_closed && !$old_closed) { 65 + if ($new == ManiphestTaskStatus::getDuplicateStatus()) { 66 + if ($commit_phid) { 67 + return pht( 68 + '%s closed this task as a duplicate by committing %s.', 69 + $this->renderAuthor(), 70 + $this->renderHandle($commit_phid)); 71 + } else { 72 + return pht( 73 + '%s closed this task as a duplicate.', 74 + $this->renderAuthor()); 75 + } 76 + } else { 77 + if ($commit_phid) { 78 + return pht( 79 + '%s closed this task as %s by committing %s.', 80 + $this->renderAuthor(), 81 + $this->renderValue($new_name), 82 + $this->renderHandle($commit_phid)); 83 + } else { 84 + return pht( 85 + '%s closed this task as %s.', 86 + $this->renderAuthor(), 87 + $this->renderValue($new_name)); 88 + } 89 + } 90 + } else if (!$new_closed && $old_closed) { 91 + if ($commit_phid) { 92 + return pht( 93 + '%s reopened this task as %s by committing %s.', 94 + $this->renderAuthor(), 95 + $this->renderValue($new_name), 96 + $this->renderHandle($commit_phid)); 97 + } else { 98 + return pht( 99 + '%s reopened this task as %s.', 100 + $this->renderAuthor(), 101 + $this->renderValue($new_name)); 102 + } 103 + } else { 104 + if ($commit_phid) { 105 + return pht( 106 + '%s changed the task status from %s to %s by committing %s.', 107 + $this->renderAuthor(), 108 + $this->renderValue($old_name), 109 + $this->renderValue($new_name), 110 + $this->renderHandle($commit_phid)); 111 + } else { 112 + return pht( 113 + '%s changed the task status from %s to %s.', 114 + $this->renderAuthor(), 115 + $this->renderValue($old_name), 116 + $this->renderValue($new_name)); 117 + } 118 + } 119 + 120 + } 121 + 122 + public function getTitleForFeed() { 123 + $old = $this->getOldValue(); 124 + $new = $this->getNewValue(); 125 + 126 + $old_closed = ManiphestTaskStatus::isClosedStatus($old); 127 + $new_closed = ManiphestTaskStatus::isClosedStatus($new); 128 + 129 + $old_name = ManiphestTaskStatus::getTaskStatusName($old); 130 + $new_name = ManiphestTaskStatus::getTaskStatusName($new); 131 + 132 + $commit_phid = $this->getMetadataValue('commitPHID'); 133 + 134 + if ($new_closed && !$old_closed) { 135 + if ($new == ManiphestTaskStatus::getDuplicateStatus()) { 136 + if ($commit_phid) { 137 + return pht( 138 + '%s closed %s as a duplicate by committing %s.', 139 + $this->renderAuthor(), 140 + $this->renderObject(), 141 + $this->renderHandle($commit_phid)); 142 + } else { 143 + return pht( 144 + '%s closed %s as a duplicate.', 145 + $this->renderAuthor(), 146 + $this->renderObject()); 147 + } 148 + } else { 149 + if ($commit_phid) { 150 + return pht( 151 + '%s closed %s as %s by committing %s.', 152 + $this->renderAuthor(), 153 + $this->renderObject(), 154 + $this->renderValue($new_name), 155 + $this->renderHandle($commit_phid)); 156 + } else { 157 + return pht( 158 + '%s closed %s as %s.', 159 + $this->renderAuthor(), 160 + $this->renderObject(), 161 + $this->renderValue($new_name)); 162 + } 163 + } 164 + } else if (!$new_closed && $old_closed) { 165 + if ($commit_phid) { 166 + return pht( 167 + '%s reopened %s as %s by committing %s.', 168 + $this->renderAuthor(), 169 + $this->renderObject(), 170 + $this->renderValue($new_name), 171 + $this->renderHandle($commit_phid)); 172 + } else { 173 + return pht( 174 + '%s reopened %s as "%s".', 175 + $this->renderAuthor(), 176 + $this->renderObject(), 177 + $new_name); 178 + } 179 + } else { 180 + if ($commit_phid) { 181 + return pht( 182 + '%s changed the status of %s from %s to %s by committing %s.', 183 + $this->renderAuthor(), 184 + $this->renderObject(), 185 + $this->renderValue($old_name), 186 + $this->renderValue($new_name), 187 + $this->renderHandle($commit_phid)); 188 + } else { 189 + return pht( 190 + '%s changed the status of %s from %s to %s.', 191 + $this->renderAuthor(), 192 + $this->renderObject(), 193 + $this->renderValue($old_name), 194 + $this->renderValue($new_name)); 195 + } 196 + } 197 + } 198 + 199 + public function getIcon() { 200 + $old = $this->getOldValue(); 201 + $new = $this->getNewValue(); 202 + 203 + $action = ManiphestTaskStatus::getStatusIcon($new); 204 + if ($action !== null) { 205 + return $action; 206 + } 207 + 208 + if (ManiphestTaskStatus::isClosedStatus($new)) { 209 + return 'fa-check'; 210 + } else { 211 + return 'fa-pencil'; 212 + } 213 + } 214 + 215 + public function getColor() { 216 + $old = $this->getOldValue(); 217 + $new = $this->getNewValue(); 218 + 219 + $color = ManiphestTaskStatus::getStatusColor($new); 220 + if ($color !== null) { 221 + return $color; 222 + } 223 + 224 + if (ManiphestTaskStatus::isOpenStatus($new)) { 225 + return 'green'; 226 + } else { 227 + return 'indigo'; 228 + } 229 + 230 + } 231 + 232 + }
+21
src/applications/maniphest/xaction/ManiphestTaskSubpriorityTransaction.php
··· 1 + <?php 2 + 3 + final class ManiphestTaskSubpriorityTransaction 4 + extends ManiphestTaskTransactionType { 5 + 6 + const TRANSACTIONTYPE = 'subpriority'; 7 + 8 + public function generateOldValue($object) { 9 + return $object->getSubpriority(); 10 + } 11 + 12 + public function applyInternalEffects($object, $value) { 13 + $object->setSubpriority($value); 14 + } 15 + 16 + public function shouldHide() { 17 + return true; 18 + } 19 + 20 + 21 + }
+74
src/applications/maniphest/xaction/ManiphestTaskTitleTransaction.php
··· 1 + <?php 2 + 3 + final class ManiphestTaskTitleTransaction 4 + extends ManiphestTaskTransactionType { 5 + 6 + const TRANSACTIONTYPE = 'title'; 7 + 8 + public function generateOldValue($object) { 9 + return $object->getTitle(); 10 + } 11 + 12 + public function applyInternalEffects($object, $value) { 13 + $object->setTitle($value); 14 + } 15 + 16 + public function getActionStrength() { 17 + return 1.4; 18 + } 19 + 20 + public function getActionName() { 21 + $old = $this->getOldValue(); 22 + $new = $this->getNewValue(); 23 + if ($old === null) { 24 + return pht('Created'); 25 + } 26 + 27 + return pht('Retitled'); 28 + } 29 + 30 + public function getTitle() { 31 + $old = $this->getOldValue(); 32 + if ($old === null) { 33 + return pht( 34 + '%s created this task.', 35 + $this->renderAuthor()); 36 + } 37 + 38 + return pht( 39 + '%s changed the title from %s to %s.', 40 + $this->renderAuthor(), 41 + $this->renderOldValue(), 42 + $this->renderNewValue()); 43 + 44 + } 45 + 46 + public function getTitleForFeed() { 47 + $old = $this->getOldValue(); 48 + if ($old === null) { 49 + return pht( 50 + '%s created %s.', 51 + $this->renderAuthor(), 52 + $this->renderObject()); 53 + } 54 + 55 + return pht( 56 + '%s changed %s title from %s to %s.', 57 + $this->renderAuthor(), 58 + $this->renderObject(), 59 + $this->renderOldValue(), 60 + $this->renderNewValue()); 61 + } 62 + 63 + public function validateTransactions($object, array $xactions) { 64 + $errors = array(); 65 + 66 + if ($this->isEmptyTextTransaction($object->getTitle(), $xactions)) { 67 + $errors[] = $this->newRequiredError( 68 + pht('Tasks must have a title.')); 69 + } 70 + 71 + return $errors; 72 + } 73 + 74 + }
+16
src/applications/maniphest/xaction/ManiphestTaskTransactionType.php
··· 1 + <?php 2 + 3 + abstract class ManiphestTaskTransactionType 4 + extends PhabricatorModularTransactionType { 5 + 6 + public function renderSubtypeName($value) { 7 + $object = $this->getObject(); 8 + $map = $object->newEditEngineSubtypeMap(); 9 + if (!isset($map[$value])) { 10 + return $value; 11 + } 12 + 13 + return $map[$value]->getName(); 14 + } 15 + 16 + }
+125
src/applications/maniphest/xaction/ManiphestTaskUnblockTransaction.php
··· 1 + <?php 2 + 3 + final class ManiphestTaskUnblockTransaction 4 + extends ManiphestTaskTransactionType { 5 + 6 + const TRANSACTIONTYPE = 'unblock'; 7 + 8 + public function generateOldValue($object) { 9 + return null; 10 + } 11 + 12 + public function shouldHideForFeed() { 13 + // Hide "alice created X, a task blocking Y." from feed because it 14 + // will almost always appear adjacent to "alice created Y". 15 + $is_new = $this->getMetadataValue('blocker.new'); 16 + if ($is_new) { 17 + return true; 18 + } 19 + } 20 + 21 + public function getActionName() { 22 + $old = $this->getOldValue(); 23 + $new = $this->getNewValue(); 24 + 25 + $old_status = head($old); 26 + $new_status = head($new); 27 + 28 + $old_closed = ManiphestTaskStatus::isClosedStatus($old_status); 29 + $new_closed = ManiphestTaskStatus::isClosedStatus($new_status); 30 + 31 + if ($old_closed && !$new_closed) { 32 + return pht('Block'); 33 + } else if (!$old_closed && $new_closed) { 34 + return pht('Unblock'); 35 + } else { 36 + return pht('Blocker'); 37 + } 38 + } 39 + 40 + public function getTitle() { 41 + $old = $this->getOldValue(); 42 + $new = $this->getNewValue(); 43 + 44 + $blocker_phid = key($new); 45 + $old_status = head($old); 46 + $new_status = head($new); 47 + 48 + $old_closed = ManiphestTaskStatus::isClosedStatus($old_status); 49 + $new_closed = ManiphestTaskStatus::isClosedStatus($new_status); 50 + 51 + $old_name = ManiphestTaskStatus::getTaskStatusName($old_status); 52 + $new_name = ManiphestTaskStatus::getTaskStatusName($new_status); 53 + 54 + if ($this->getMetadataValue('blocker.new')) { 55 + return pht( 56 + '%s created subtask %s.', 57 + $this->renderAuthor(), 58 + $this->renderHandle($blocker_phid)); 59 + } else if ($old_closed && !$new_closed) { 60 + return pht( 61 + '%s reopened subtask %s as %s.', 62 + $this->renderAuthor(), 63 + $this->renderHandle($blocker_phid), 64 + $this->renderValue($new_name)); 65 + } else if (!$old_closed && $new_closed) { 66 + return pht( 67 + '%s closed subtask %s as %s.', 68 + $this->renderAuthor(), 69 + $this->renderHandle($blocker_phid), 70 + $this->renderValue($new_name)); 71 + } else { 72 + return pht( 73 + '%s changed the status of subtask %s from %s to %s.', 74 + $this->renderAuthor(), 75 + $this->renderHandle($blocker_phid), 76 + $this->renderValue($old_name), 77 + $this->renderValue($new_name)); 78 + } 79 + } 80 + 81 + public function getTitleForFeed() { 82 + $old = $this->getOldValue(); 83 + $new = $this->getNewValue(); 84 + $blocker_phid = key($new); 85 + $old_status = head($old); 86 + $new_status = head($new); 87 + 88 + $old_closed = ManiphestTaskStatus::isClosedStatus($old_status); 89 + $new_closed = ManiphestTaskStatus::isClosedStatus($new_status); 90 + 91 + $old_name = ManiphestTaskStatus::getTaskStatusName($old_status); 92 + $new_name = ManiphestTaskStatus::getTaskStatusName($new_status); 93 + 94 + if ($old_closed && !$new_closed) { 95 + return pht( 96 + '%s reopened %s, a subtask of %s, as %s.', 97 + $this->renderAuthor(), 98 + $this->renderHandle($blocker_phid), 99 + $this->renderObject(), 100 + $this->renderValue($new_name)); 101 + } else if (!$old_closed && $new_closed) { 102 + return pht( 103 + '%s closed %s, a subtask of %s, as %s.', 104 + $this->renderAuthor(), 105 + $this->renderHandle($blocker_phid), 106 + $this->renderObject(), 107 + $this->renderValue($new_name)); 108 + } else { 109 + return pht( 110 + '%s changed the status of %s, a subtask of %s, '. 111 + 'from %s to %s.', 112 + $this->renderAuthor(), 113 + $this->renderHandle($blocker_phid), 114 + $this->renderObject(), 115 + $this->renderValue($old_name), 116 + $this->renderValue($new_name)); 117 + } 118 + } 119 + 120 + public function getIcon() { 121 + return 'fa-shield'; 122 + } 123 + 124 + 125 + }
+4 -2
src/applications/nuance/item/NuanceGitHubEventItemType.php
··· 390 390 $state = $xobj->getProperty('task.state'); 391 391 392 392 $xactions[] = id(new ManiphestTransaction()) 393 - ->setTransactionType(ManiphestTransaction::TYPE_TITLE) 393 + ->setTransactionType( 394 + ManiphestTaskTitleTransaction::TRANSACTIONTYPE) 394 395 ->setNewValue($title) 395 396 ->setDateCreated($created); 396 397 397 398 $xactions[] = id(new ManiphestTransaction()) 398 - ->setTransactionType(ManiphestTransaction::TYPE_DESCRIPTION) 399 + ->setTransactionType( 400 + ManiphestTaskDescriptionTransaction::TRANSACTIONTYPE) 399 401 ->setNewValue($description) 400 402 ->setDateCreated($created); 401 403
+1 -1
src/applications/project/__tests__/PhabricatorProjectCoreTestCase.php
··· 1337 1337 $xactions = array(); 1338 1338 1339 1339 $xactions[] = id(new ManiphestTransaction()) 1340 - ->setTransactionType(ManiphestTransaction::TYPE_TITLE) 1340 + ->setTransactionType(ManiphestTaskTitleTransaction::TRANSACTIONTYPE) 1341 1341 ->setNewValue($name); 1342 1342 1343 1343 if ($projects) {
+1 -1
src/applications/project/controller/PhabricatorProjectCoverController.php
··· 36 36 $xactions = array(); 37 37 38 38 $xactions[] = id(new ManiphestTransaction()) 39 - ->setTransactionType(ManiphestTransaction::TYPE_COVER_IMAGE) 39 + ->setTransactionType(ManiphestTaskCoverImageTransaction::TRANSACTIONTYPE) 40 40 ->setNewValue($file->getPHID()); 41 41 42 42 $editor = id(new ManiphestTransactionEditor())
+3 -2
src/applications/project/controller/PhabricatorProjectMoveController.php
··· 153 153 $xactions = array(); 154 154 if ($pri !== null) { 155 155 $xactions[] = id(new ManiphestTransaction()) 156 - ->setTransactionType(ManiphestTransaction::TYPE_PRIORITY) 156 + ->setTransactionType(ManiphestTaskPriorityTransaction::TRANSACTIONTYPE) 157 157 ->setNewValue($pri); 158 158 $xactions[] = id(new ManiphestTransaction()) 159 - ->setTransactionType(ManiphestTransaction::TYPE_SUBPRIORITY) 159 + ->setTransactionType( 160 + ManiphestTaskSubpriorityTransaction::TRANSACTIONTYPE) 160 161 ->setNewValue($sub); 161 162 } 162 163
+2 -1
src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php
··· 367 367 if ($status) { 368 368 if ($task->getStatus() != $status) { 369 369 $xactions[] = id(new ManiphestTransaction()) 370 - ->setTransactionType(ManiphestTransaction::TYPE_STATUS) 370 + ->setTransactionType( 371 + ManiphestTaskStatusTransaction::TRANSACTIONTYPE) 371 372 ->setMetadataValue('commitPHID', $commit->getPHID()) 372 373 ->setNewValue($status); 373 374