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

Modularize all remaining Maniphest Herald fields

Summary:
Ref T8726. The only notable bit here is that the "body" / "title" fields (which are currently shared across a bunch of types) are getting split into application variants.

Among other things, this will let us label the field "Commit message" for commits, for example.

Test Plan:
- Created a rule using all four fields.
- Applied patch, saw rule break ("unknown field").
- Ran storage upgrade, saw rule fix itself in the migration.
- Edited tasks, triggered rule, viewed transcripts.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: eadler, joshuaspence, epriestley

Maniphest Tasks: T8726

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

+160 -39
+30
resources/sql/autopatches/20150630.herald.2.sql
··· 1 + # This converts old conditions which use common fields like "body" to new 2 + # conditions which use modular rules like "Maniphest Task Description". 3 + 4 + UPDATE {$NAMESPACE}_herald.herald_condition c 5 + JOIN {$NAMESPACE}_herald.herald_rule r 6 + ON c.ruleID = r.id 7 + SET c.fieldName = 'maniphest.task.title' 8 + WHERE r.contentType = 'HeraldManiphestTaskAdapter' 9 + AND c.fieldName = 'title'; 10 + 11 + UPDATE {$NAMESPACE}_herald.herald_condition c 12 + JOIN {$NAMESPACE}_herald.herald_rule r 13 + ON c.ruleID = r.id 14 + SET c.fieldName = 'maniphest.task.description' 15 + WHERE r.contentType = 'HeraldManiphestTaskAdapter' 16 + AND c.fieldName = 'body'; 17 + 18 + UPDATE {$NAMESPACE}_herald.herald_condition c 19 + JOIN {$NAMESPACE}_herald.herald_rule r 20 + ON c.ruleID = r.id 21 + SET c.fieldName = 'maniphest.task.author' 22 + WHERE r.contentType = 'HeraldManiphestTaskAdapter' 23 + AND c.fieldName = 'author'; 24 + 25 + UPDATE {$NAMESPACE}_herald.herald_condition c 26 + JOIN {$NAMESPACE}_herald.herald_rule r 27 + ON c.ruleID = r.id 28 + SET c.fieldName = 'maniphest.task.assignee' 29 + WHERE r.contentType = 'HeraldManiphestTaskAdapter' 30 + AND c.fieldName = 'assignee';
+12 -4
src/__phutil_library_map__.php
··· 1072 1072 'ManiphestExcelFormatTestCase' => 'applications/maniphest/export/__tests__/ManiphestExcelFormatTestCase.php', 1073 1073 'ManiphestExportController' => 'applications/maniphest/controller/ManiphestExportController.php', 1074 1074 'ManiphestGetTaskTransactionsConduitAPIMethod' => 'applications/maniphest/conduit/ManiphestGetTaskTransactionsConduitAPIMethod.php', 1075 - 'ManiphestHeraldField' => 'applications/maniphest/herald/ManiphestHeraldField.php', 1076 1075 'ManiphestHovercardEventListener' => 'applications/maniphest/event/ManiphestHovercardEventListener.php', 1077 1076 'ManiphestInfoConduitAPIMethod' => 'applications/maniphest/conduit/ManiphestInfoConduitAPIMethod.php', 1078 1077 'ManiphestNameIndex' => 'applications/maniphest/storage/ManiphestNameIndex.php', ··· 1089 1088 'ManiphestStatusEmailCommand' => 'applications/maniphest/command/ManiphestStatusEmailCommand.php', 1090 1089 'ManiphestSubpriorityController' => 'applications/maniphest/controller/ManiphestSubpriorityController.php', 1091 1090 'ManiphestTask' => 'applications/maniphest/storage/ManiphestTask.php', 1091 + 'ManiphestTaskAssigneeHeraldField' => 'applications/maniphest/herald/ManiphestTaskAssigneeHeraldField.php', 1092 + 'ManiphestTaskAuthorHeraldField' => 'applications/maniphest/herald/ManiphestTaskAuthorHeraldField.php', 1092 1093 'ManiphestTaskAuthorPolicyRule' => 'applications/maniphest/policyrule/ManiphestTaskAuthorPolicyRule.php', 1093 1094 'ManiphestTaskClosedStatusDatasource' => 'applications/maniphest/typeahead/ManiphestTaskClosedStatusDatasource.php', 1094 1095 'ManiphestTaskDependedOnByTaskEdgeType' => 'applications/maniphest/edge/ManiphestTaskDependedOnByTaskEdgeType.php', 1095 1096 'ManiphestTaskDependsOnTaskEdgeType' => 'applications/maniphest/edge/ManiphestTaskDependsOnTaskEdgeType.php', 1097 + 'ManiphestTaskDescriptionHeraldField' => 'applications/maniphest/herald/ManiphestTaskDescriptionHeraldField.php', 1096 1098 'ManiphestTaskDetailController' => 'applications/maniphest/controller/ManiphestTaskDetailController.php', 1097 1099 'ManiphestTaskEditBulkJobType' => 'applications/maniphest/bulk/ManiphestTaskEditBulkJobType.php', 1098 1100 'ManiphestTaskEditController' => 'applications/maniphest/controller/ManiphestTaskEditController.php', 1099 1101 'ManiphestTaskHasCommitEdgeType' => 'applications/maniphest/edge/ManiphestTaskHasCommitEdgeType.php', 1100 1102 'ManiphestTaskHasMockEdgeType' => 'applications/maniphest/edge/ManiphestTaskHasMockEdgeType.php', 1101 1103 'ManiphestTaskHasRevisionEdgeType' => 'applications/maniphest/edge/ManiphestTaskHasRevisionEdgeType.php', 1104 + 'ManiphestTaskHeraldField' => 'applications/maniphest/herald/ManiphestTaskHeraldField.php', 1102 1105 'ManiphestTaskListController' => 'applications/maniphest/controller/ManiphestTaskListController.php', 1103 1106 'ManiphestTaskListView' => 'applications/maniphest/view/ManiphestTaskListView.php', 1104 1107 'ManiphestTaskMailReceiver' => 'applications/maniphest/mail/ManiphestTaskMailReceiver.php', ··· 1116 1119 'ManiphestTaskStatusHeraldField' => 'applications/maniphest/herald/ManiphestTaskStatusHeraldField.php', 1117 1120 'ManiphestTaskStatusTestCase' => 'applications/maniphest/constants/__tests__/ManiphestTaskStatusTestCase.php', 1118 1121 'ManiphestTaskTestCase' => 'applications/maniphest/__tests__/ManiphestTaskTestCase.php', 1122 + 'ManiphestTaskTitleHeraldField' => 'applications/maniphest/herald/ManiphestTaskTitleHeraldField.php', 1119 1123 'ManiphestTransaction' => 'applications/maniphest/storage/ManiphestTransaction.php', 1120 1124 'ManiphestTransactionComment' => 'applications/maniphest/storage/ManiphestTransactionComment.php', 1121 1125 'ManiphestTransactionEditor' => 'applications/maniphest/editor/ManiphestTransactionEditor.php', ··· 4605 4609 'ManiphestExcelFormatTestCase' => 'PhabricatorTestCase', 4606 4610 'ManiphestExportController' => 'ManiphestController', 4607 4611 'ManiphestGetTaskTransactionsConduitAPIMethod' => 'ManiphestConduitAPIMethod', 4608 - 'ManiphestHeraldField' => 'HeraldField', 4609 4612 'ManiphestHovercardEventListener' => 'PhabricatorEventListener', 4610 4613 'ManiphestInfoConduitAPIMethod' => 'ManiphestConduitAPIMethod', 4611 4614 'ManiphestNameIndex' => 'ManiphestDAO', ··· 4636 4639 'PhabricatorProjectInterface', 4637 4640 'PhabricatorSpacesInterface', 4638 4641 ), 4642 + 'ManiphestTaskAssigneeHeraldField' => 'ManiphestTaskHeraldField', 4643 + 'ManiphestTaskAuthorHeraldField' => 'ManiphestTaskHeraldField', 4639 4644 'ManiphestTaskAuthorPolicyRule' => 'PhabricatorPolicyRule', 4640 4645 'ManiphestTaskClosedStatusDatasource' => 'PhabricatorTypeaheadDatasource', 4641 4646 'ManiphestTaskDependedOnByTaskEdgeType' => 'PhabricatorEdgeType', 4642 4647 'ManiphestTaskDependsOnTaskEdgeType' => 'PhabricatorEdgeType', 4648 + 'ManiphestTaskDescriptionHeraldField' => 'ManiphestTaskHeraldField', 4643 4649 'ManiphestTaskDetailController' => 'ManiphestController', 4644 4650 'ManiphestTaskEditBulkJobType' => 'PhabricatorWorkerBulkJobType', 4645 4651 'ManiphestTaskEditController' => 'ManiphestController', 4646 4652 'ManiphestTaskHasCommitEdgeType' => 'PhabricatorEdgeType', 4647 4653 'ManiphestTaskHasMockEdgeType' => 'PhabricatorEdgeType', 4648 4654 'ManiphestTaskHasRevisionEdgeType' => 'PhabricatorEdgeType', 4655 + 'ManiphestTaskHeraldField' => 'HeraldField', 4649 4656 'ManiphestTaskListController' => 'ManiphestController', 4650 4657 'ManiphestTaskListView' => 'ManiphestView', 4651 4658 'ManiphestTaskMailReceiver' => 'PhabricatorObjectMailReceiver', ··· 4653 4660 'ManiphestTaskPHIDType' => 'PhabricatorPHIDType', 4654 4661 'ManiphestTaskPriority' => 'ManiphestConstants', 4655 4662 'ManiphestTaskPriorityDatasource' => 'PhabricatorTypeaheadDatasource', 4656 - 'ManiphestTaskPriorityHeraldField' => 'ManiphestHeraldField', 4663 + 'ManiphestTaskPriorityHeraldField' => 'ManiphestTaskHeraldField', 4657 4664 'ManiphestTaskQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 4658 4665 'ManiphestTaskResultListView' => 'ManiphestView', 4659 4666 'ManiphestTaskSearchEngine' => 'PhabricatorApplicationSearchEngine', 4660 4667 'ManiphestTaskStatus' => 'ManiphestConstants', 4661 4668 'ManiphestTaskStatusDatasource' => 'PhabricatorTypeaheadDatasource', 4662 4669 'ManiphestTaskStatusFunctionDatasource' => 'PhabricatorTypeaheadCompositeDatasource', 4663 - 'ManiphestTaskStatusHeraldField' => 'ManiphestHeraldField', 4670 + 'ManiphestTaskStatusHeraldField' => 'ManiphestTaskHeraldField', 4664 4671 'ManiphestTaskStatusTestCase' => 'PhabricatorTestCase', 4665 4672 'ManiphestTaskTestCase' => 'PhabricatorTestCase', 4673 + 'ManiphestTaskTitleHeraldField' => 'ManiphestTaskHeraldField', 4666 4674 'ManiphestTransaction' => 'PhabricatorApplicationTransaction', 4667 4675 'ManiphestTransactionComment' => 'PhabricatorApplicationTransactionComment', 4668 4676 'ManiphestTransactionEditor' => 'PhabricatorApplicationTransactionEditor',
-3
src/applications/herald/adapter/HeraldAdapter.php
··· 5 5 const FIELD_TITLE = 'title'; 6 6 const FIELD_BODY = 'body'; 7 7 const FIELD_AUTHOR = 'author'; 8 - const FIELD_ASSIGNEE = 'assignee'; 9 8 const FIELD_REVIEWER = 'reviewer'; 10 9 const FIELD_REVIEWERS = 'reviewers'; 11 10 const FIELD_COMMITTER = 'committer'; ··· 355 354 self::FIELD_TITLE => pht('Title'), 356 355 self::FIELD_BODY => pht('Body'), 357 356 self::FIELD_AUTHOR => pht('Author'), 358 - self::FIELD_ASSIGNEE => pht('Assignee'), 359 357 self::FIELD_COMMITTER => pht('Committer'), 360 358 self::FIELD_REVIEWER => pht('Reviewer'), 361 359 self::FIELD_REVIEWERS => pht('Reviewers'), ··· 444 442 self::CONDITION_IS_NOT_ANY, 445 443 ); 446 444 case self::FIELD_REPOSITORY: 447 - case self::FIELD_ASSIGNEE: 448 445 case self::FIELD_AUTHOR: 449 446 case self::FIELD_COMMITTER: 450 447 return array(
+17 -1
src/applications/herald/field/HeraldField.php
··· 6 6 7 7 const STANDARD_LIST = 'standard.list'; 8 8 const STANDARD_BOOL = 'standard.bool'; 9 + const STANDARD_TEXT = 'standard.text'; 9 10 const STANDARD_PHID = 'standard.phid'; 11 + const STANDARD_PHID_NULLABLE = 'standard.phid.nullable'; 10 12 11 13 abstract public function getHeraldFieldName(); 12 14 abstract public function getHeraldFieldValue($object); ··· 26 28 HeraldAdapter::CONDITION_IS_TRUE, 27 29 HeraldAdapter::CONDITION_IS_FALSE, 28 30 ); 31 + case self::STANDARD_TEXT: 32 + return array( 33 + HeraldAdapter::CONDITION_CONTAINS, 34 + HeraldAdapter::CONDITION_NOT_CONTAINS, 35 + HeraldAdapter::CONDITION_IS, 36 + HeraldAdapter::CONDITION_IS_NOT, 37 + HeraldAdapter::CONDITION_REGEXP, 38 + ); 29 39 case self::STANDARD_PHID: 30 40 return array( 31 41 HeraldAdapter::CONDITION_IS_ANY, 32 42 HeraldAdapter::CONDITION_IS_NOT_ANY, 33 43 ); 34 - 44 + case self::STANDARD_PHID_NULLABLE: 45 + return array( 46 + HeraldAdapter::CONDITION_IS_ANY, 47 + HeraldAdapter::CONDITION_IS_NOT_ANY, 48 + HeraldAdapter::CONDITION_EXISTS, 49 + HeraldAdapter::CONDITION_NOT_EXISTS, 50 + ); 35 51 } 36 52 37 53 throw new Exception(pht('Unknown standard condition set.'));
-26
src/applications/maniphest/herald/HeraldManiphestTaskAdapter.php
··· 67 67 return pht('Maniphest Tasks'); 68 68 } 69 69 70 - public function getFields() { 71 - return array_merge( 72 - array( 73 - self::FIELD_TITLE, 74 - self::FIELD_BODY, 75 - self::FIELD_AUTHOR, 76 - self::FIELD_ASSIGNEE, 77 - ), 78 - parent::getFields()); 79 - } 80 - 81 70 public function getActions($rule_type) { 82 71 switch ($rule_type) { 83 72 case HeraldRuleTypeConfig::RULE_TYPE_GLOBAL: ··· 110 99 111 100 public function getHeraldName() { 112 101 return 'T'.$this->getTask()->getID(); 113 - } 114 - 115 - public function getHeraldField($field) { 116 - switch ($field) { 117 - case self::FIELD_TITLE: 118 - return $this->getTask()->getTitle(); 119 - case self::FIELD_BODY: 120 - return $this->getTask()->getDescription(); 121 - case self::FIELD_AUTHOR: 122 - return $this->getTask()->getAuthorPHID(); 123 - case self::FIELD_ASSIGNEE: 124 - return $this->getTask()->getOwnerPHID(); 125 - } 126 - 127 - return parent::getHeraldField($field); 128 102 } 129 103 130 104 public function applyHeraldEffects(array $effects) {
+1 -1
src/applications/maniphest/herald/ManiphestHeraldField.php src/applications/maniphest/herald/ManiphestTaskHeraldField.php
··· 1 1 <?php 2 2 3 - abstract class ManiphestHeraldField extends HeraldField { 3 + abstract class ManiphestTaskHeraldField extends HeraldField { 4 4 5 5 public function supportsObject($object) { 6 6 return ($object instanceof ManiphestTask);
+24
src/applications/maniphest/herald/ManiphestTaskAssigneeHeraldField.php
··· 1 + <?php 2 + 3 + final class ManiphestTaskAssigneeHeraldField 4 + extends ManiphestTaskHeraldField { 5 + 6 + const FIELDCONST = 'maniphest.task.assignee'; 7 + 8 + public function getHeraldFieldName() { 9 + return pht('Assignee'); 10 + } 11 + 12 + public function getHeraldFieldValue($object) { 13 + return $object->getOwnerPHID(); 14 + } 15 + 16 + protected function getHeraldFieldStandardConditions() { 17 + return self::STANDARD_PHID_NULLABLE; 18 + } 19 + 20 + public function getHeraldFieldValueType($condition) { 21 + return HeraldAdapter::VALUE_USER; 22 + } 23 + 24 + }
+24
src/applications/maniphest/herald/ManiphestTaskAuthorHeraldField.php
··· 1 + <?php 2 + 3 + final class ManiphestTaskAuthorHeraldField 4 + extends ManiphestTaskHeraldField { 5 + 6 + const FIELDCONST = 'maniphest.task.author'; 7 + 8 + public function getHeraldFieldName() { 9 + return pht('Author'); 10 + } 11 + 12 + public function getHeraldFieldValue($object) { 13 + return $object->getAuthorPHID(); 14 + } 15 + 16 + protected function getHeraldFieldStandardConditions() { 17 + return self::STANDARD_PHID; 18 + } 19 + 20 + public function getHeraldFieldValueType($condition) { 21 + return HeraldAdapter::VALUE_USER; 22 + } 23 + 24 + }
+24
src/applications/maniphest/herald/ManiphestTaskDescriptionHeraldField.php
··· 1 + <?php 2 + 3 + final class ManiphestTaskDescriptionHeraldField 4 + extends ManiphestTaskHeraldField { 5 + 6 + const FIELDCONST = 'maniphest.task.description'; 7 + 8 + public function getHeraldFieldName() { 9 + return pht('Description'); 10 + } 11 + 12 + public function getHeraldFieldValue($object) { 13 + return $object->getDescription(); 14 + } 15 + 16 + protected function getHeraldFieldStandardConditions() { 17 + return self::STANDARD_TEXT; 18 + } 19 + 20 + public function getHeraldFieldValueType($condition) { 21 + return HeraldAdapter::VALUE_TEXT; 22 + } 23 + 24 + }
+2 -2
src/applications/maniphest/herald/ManiphestTaskPriorityHeraldField.php
··· 1 1 <?php 2 2 3 3 final class ManiphestTaskPriorityHeraldField 4 - extends ManiphestHeraldField { 4 + extends ManiphestTaskHeraldField { 5 5 6 6 const FIELDCONST = 'taskpriority'; 7 7 8 8 public function getHeraldFieldName() { 9 - return pht('Task priority'); 9 + return pht('Priority'); 10 10 } 11 11 12 12 public function getHeraldFieldValue($object) {
+2 -2
src/applications/maniphest/herald/ManiphestTaskStatusHeraldField.php
··· 1 1 <?php 2 2 3 3 final class ManiphestTaskStatusHeraldField 4 - extends ManiphestHeraldField { 4 + extends ManiphestTaskHeraldField { 5 5 6 6 const FIELDCONST = 'taskstatus'; 7 7 8 8 public function getHeraldFieldName() { 9 - return pht('Task status'); 9 + return pht('Status'); 10 10 } 11 11 12 12 public function getHeraldFieldValue($object) {
+24
src/applications/maniphest/herald/ManiphestTaskTitleHeraldField.php
··· 1 + <?php 2 + 3 + final class ManiphestTaskTitleHeraldField 4 + extends ManiphestTaskHeraldField { 5 + 6 + const FIELDCONST = 'maniphest.task.title'; 7 + 8 + public function getHeraldFieldName() { 9 + return pht('Title'); 10 + } 11 + 12 + public function getHeraldFieldValue($object) { 13 + return $object->getTitle(); 14 + } 15 + 16 + protected function getHeraldFieldStandardConditions() { 17 + return self::STANDARD_TEXT; 18 + } 19 + 20 + public function getHeraldFieldValueType($condition) { 21 + return HeraldAdapter::VALUE_TEXT; 22 + } 23 + 24 + }