mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-18 19:40:55 +01:00
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
This commit is contained in:
parent
c02c83108d
commit
83c0fda280
12 changed files with 160 additions and 39 deletions
30
resources/sql/autopatches/20150630.herald.2.sql
Normal file
30
resources/sql/autopatches/20150630.herald.2.sql
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
# This converts old conditions which use common fields like "body" to new
|
||||||
|
# conditions which use modular rules like "Maniphest Task Description".
|
||||||
|
|
||||||
|
UPDATE {$NAMESPACE}_herald.herald_condition c
|
||||||
|
JOIN {$NAMESPACE}_herald.herald_rule r
|
||||||
|
ON c.ruleID = r.id
|
||||||
|
SET c.fieldName = 'maniphest.task.title'
|
||||||
|
WHERE r.contentType = 'HeraldManiphestTaskAdapter'
|
||||||
|
AND c.fieldName = 'title';
|
||||||
|
|
||||||
|
UPDATE {$NAMESPACE}_herald.herald_condition c
|
||||||
|
JOIN {$NAMESPACE}_herald.herald_rule r
|
||||||
|
ON c.ruleID = r.id
|
||||||
|
SET c.fieldName = 'maniphest.task.description'
|
||||||
|
WHERE r.contentType = 'HeraldManiphestTaskAdapter'
|
||||||
|
AND c.fieldName = 'body';
|
||||||
|
|
||||||
|
UPDATE {$NAMESPACE}_herald.herald_condition c
|
||||||
|
JOIN {$NAMESPACE}_herald.herald_rule r
|
||||||
|
ON c.ruleID = r.id
|
||||||
|
SET c.fieldName = 'maniphest.task.author'
|
||||||
|
WHERE r.contentType = 'HeraldManiphestTaskAdapter'
|
||||||
|
AND c.fieldName = 'author';
|
||||||
|
|
||||||
|
UPDATE {$NAMESPACE}_herald.herald_condition c
|
||||||
|
JOIN {$NAMESPACE}_herald.herald_rule r
|
||||||
|
ON c.ruleID = r.id
|
||||||
|
SET c.fieldName = 'maniphest.task.assignee'
|
||||||
|
WHERE r.contentType = 'HeraldManiphestTaskAdapter'
|
||||||
|
AND c.fieldName = 'assignee';
|
|
@ -1072,7 +1072,6 @@ phutil_register_library_map(array(
|
||||||
'ManiphestExcelFormatTestCase' => 'applications/maniphest/export/__tests__/ManiphestExcelFormatTestCase.php',
|
'ManiphestExcelFormatTestCase' => 'applications/maniphest/export/__tests__/ManiphestExcelFormatTestCase.php',
|
||||||
'ManiphestExportController' => 'applications/maniphest/controller/ManiphestExportController.php',
|
'ManiphestExportController' => 'applications/maniphest/controller/ManiphestExportController.php',
|
||||||
'ManiphestGetTaskTransactionsConduitAPIMethod' => 'applications/maniphest/conduit/ManiphestGetTaskTransactionsConduitAPIMethod.php',
|
'ManiphestGetTaskTransactionsConduitAPIMethod' => 'applications/maniphest/conduit/ManiphestGetTaskTransactionsConduitAPIMethod.php',
|
||||||
'ManiphestHeraldField' => 'applications/maniphest/herald/ManiphestHeraldField.php',
|
|
||||||
'ManiphestHovercardEventListener' => 'applications/maniphest/event/ManiphestHovercardEventListener.php',
|
'ManiphestHovercardEventListener' => 'applications/maniphest/event/ManiphestHovercardEventListener.php',
|
||||||
'ManiphestInfoConduitAPIMethod' => 'applications/maniphest/conduit/ManiphestInfoConduitAPIMethod.php',
|
'ManiphestInfoConduitAPIMethod' => 'applications/maniphest/conduit/ManiphestInfoConduitAPIMethod.php',
|
||||||
'ManiphestNameIndex' => 'applications/maniphest/storage/ManiphestNameIndex.php',
|
'ManiphestNameIndex' => 'applications/maniphest/storage/ManiphestNameIndex.php',
|
||||||
|
@ -1089,16 +1088,20 @@ phutil_register_library_map(array(
|
||||||
'ManiphestStatusEmailCommand' => 'applications/maniphest/command/ManiphestStatusEmailCommand.php',
|
'ManiphestStatusEmailCommand' => 'applications/maniphest/command/ManiphestStatusEmailCommand.php',
|
||||||
'ManiphestSubpriorityController' => 'applications/maniphest/controller/ManiphestSubpriorityController.php',
|
'ManiphestSubpriorityController' => 'applications/maniphest/controller/ManiphestSubpriorityController.php',
|
||||||
'ManiphestTask' => 'applications/maniphest/storage/ManiphestTask.php',
|
'ManiphestTask' => 'applications/maniphest/storage/ManiphestTask.php',
|
||||||
|
'ManiphestTaskAssigneeHeraldField' => 'applications/maniphest/herald/ManiphestTaskAssigneeHeraldField.php',
|
||||||
|
'ManiphestTaskAuthorHeraldField' => 'applications/maniphest/herald/ManiphestTaskAuthorHeraldField.php',
|
||||||
'ManiphestTaskAuthorPolicyRule' => 'applications/maniphest/policyrule/ManiphestTaskAuthorPolicyRule.php',
|
'ManiphestTaskAuthorPolicyRule' => 'applications/maniphest/policyrule/ManiphestTaskAuthorPolicyRule.php',
|
||||||
'ManiphestTaskClosedStatusDatasource' => 'applications/maniphest/typeahead/ManiphestTaskClosedStatusDatasource.php',
|
'ManiphestTaskClosedStatusDatasource' => 'applications/maniphest/typeahead/ManiphestTaskClosedStatusDatasource.php',
|
||||||
'ManiphestTaskDependedOnByTaskEdgeType' => 'applications/maniphest/edge/ManiphestTaskDependedOnByTaskEdgeType.php',
|
'ManiphestTaskDependedOnByTaskEdgeType' => 'applications/maniphest/edge/ManiphestTaskDependedOnByTaskEdgeType.php',
|
||||||
'ManiphestTaskDependsOnTaskEdgeType' => 'applications/maniphest/edge/ManiphestTaskDependsOnTaskEdgeType.php',
|
'ManiphestTaskDependsOnTaskEdgeType' => 'applications/maniphest/edge/ManiphestTaskDependsOnTaskEdgeType.php',
|
||||||
|
'ManiphestTaskDescriptionHeraldField' => 'applications/maniphest/herald/ManiphestTaskDescriptionHeraldField.php',
|
||||||
'ManiphestTaskDetailController' => 'applications/maniphest/controller/ManiphestTaskDetailController.php',
|
'ManiphestTaskDetailController' => 'applications/maniphest/controller/ManiphestTaskDetailController.php',
|
||||||
'ManiphestTaskEditBulkJobType' => 'applications/maniphest/bulk/ManiphestTaskEditBulkJobType.php',
|
'ManiphestTaskEditBulkJobType' => 'applications/maniphest/bulk/ManiphestTaskEditBulkJobType.php',
|
||||||
'ManiphestTaskEditController' => 'applications/maniphest/controller/ManiphestTaskEditController.php',
|
'ManiphestTaskEditController' => 'applications/maniphest/controller/ManiphestTaskEditController.php',
|
||||||
'ManiphestTaskHasCommitEdgeType' => 'applications/maniphest/edge/ManiphestTaskHasCommitEdgeType.php',
|
'ManiphestTaskHasCommitEdgeType' => 'applications/maniphest/edge/ManiphestTaskHasCommitEdgeType.php',
|
||||||
'ManiphestTaskHasMockEdgeType' => 'applications/maniphest/edge/ManiphestTaskHasMockEdgeType.php',
|
'ManiphestTaskHasMockEdgeType' => 'applications/maniphest/edge/ManiphestTaskHasMockEdgeType.php',
|
||||||
'ManiphestTaskHasRevisionEdgeType' => 'applications/maniphest/edge/ManiphestTaskHasRevisionEdgeType.php',
|
'ManiphestTaskHasRevisionEdgeType' => 'applications/maniphest/edge/ManiphestTaskHasRevisionEdgeType.php',
|
||||||
|
'ManiphestTaskHeraldField' => 'applications/maniphest/herald/ManiphestTaskHeraldField.php',
|
||||||
'ManiphestTaskListController' => 'applications/maniphest/controller/ManiphestTaskListController.php',
|
'ManiphestTaskListController' => 'applications/maniphest/controller/ManiphestTaskListController.php',
|
||||||
'ManiphestTaskListView' => 'applications/maniphest/view/ManiphestTaskListView.php',
|
'ManiphestTaskListView' => 'applications/maniphest/view/ManiphestTaskListView.php',
|
||||||
'ManiphestTaskMailReceiver' => 'applications/maniphest/mail/ManiphestTaskMailReceiver.php',
|
'ManiphestTaskMailReceiver' => 'applications/maniphest/mail/ManiphestTaskMailReceiver.php',
|
||||||
|
@ -1116,6 +1119,7 @@ phutil_register_library_map(array(
|
||||||
'ManiphestTaskStatusHeraldField' => 'applications/maniphest/herald/ManiphestTaskStatusHeraldField.php',
|
'ManiphestTaskStatusHeraldField' => 'applications/maniphest/herald/ManiphestTaskStatusHeraldField.php',
|
||||||
'ManiphestTaskStatusTestCase' => 'applications/maniphest/constants/__tests__/ManiphestTaskStatusTestCase.php',
|
'ManiphestTaskStatusTestCase' => 'applications/maniphest/constants/__tests__/ManiphestTaskStatusTestCase.php',
|
||||||
'ManiphestTaskTestCase' => 'applications/maniphest/__tests__/ManiphestTaskTestCase.php',
|
'ManiphestTaskTestCase' => 'applications/maniphest/__tests__/ManiphestTaskTestCase.php',
|
||||||
|
'ManiphestTaskTitleHeraldField' => 'applications/maniphest/herald/ManiphestTaskTitleHeraldField.php',
|
||||||
'ManiphestTransaction' => 'applications/maniphest/storage/ManiphestTransaction.php',
|
'ManiphestTransaction' => 'applications/maniphest/storage/ManiphestTransaction.php',
|
||||||
'ManiphestTransactionComment' => 'applications/maniphest/storage/ManiphestTransactionComment.php',
|
'ManiphestTransactionComment' => 'applications/maniphest/storage/ManiphestTransactionComment.php',
|
||||||
'ManiphestTransactionEditor' => 'applications/maniphest/editor/ManiphestTransactionEditor.php',
|
'ManiphestTransactionEditor' => 'applications/maniphest/editor/ManiphestTransactionEditor.php',
|
||||||
|
@ -4605,7 +4609,6 @@ phutil_register_library_map(array(
|
||||||
'ManiphestExcelFormatTestCase' => 'PhabricatorTestCase',
|
'ManiphestExcelFormatTestCase' => 'PhabricatorTestCase',
|
||||||
'ManiphestExportController' => 'ManiphestController',
|
'ManiphestExportController' => 'ManiphestController',
|
||||||
'ManiphestGetTaskTransactionsConduitAPIMethod' => 'ManiphestConduitAPIMethod',
|
'ManiphestGetTaskTransactionsConduitAPIMethod' => 'ManiphestConduitAPIMethod',
|
||||||
'ManiphestHeraldField' => 'HeraldField',
|
|
||||||
'ManiphestHovercardEventListener' => 'PhabricatorEventListener',
|
'ManiphestHovercardEventListener' => 'PhabricatorEventListener',
|
||||||
'ManiphestInfoConduitAPIMethod' => 'ManiphestConduitAPIMethod',
|
'ManiphestInfoConduitAPIMethod' => 'ManiphestConduitAPIMethod',
|
||||||
'ManiphestNameIndex' => 'ManiphestDAO',
|
'ManiphestNameIndex' => 'ManiphestDAO',
|
||||||
|
@ -4636,16 +4639,20 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorProjectInterface',
|
'PhabricatorProjectInterface',
|
||||||
'PhabricatorSpacesInterface',
|
'PhabricatorSpacesInterface',
|
||||||
),
|
),
|
||||||
|
'ManiphestTaskAssigneeHeraldField' => 'ManiphestTaskHeraldField',
|
||||||
|
'ManiphestTaskAuthorHeraldField' => 'ManiphestTaskHeraldField',
|
||||||
'ManiphestTaskAuthorPolicyRule' => 'PhabricatorPolicyRule',
|
'ManiphestTaskAuthorPolicyRule' => 'PhabricatorPolicyRule',
|
||||||
'ManiphestTaskClosedStatusDatasource' => 'PhabricatorTypeaheadDatasource',
|
'ManiphestTaskClosedStatusDatasource' => 'PhabricatorTypeaheadDatasource',
|
||||||
'ManiphestTaskDependedOnByTaskEdgeType' => 'PhabricatorEdgeType',
|
'ManiphestTaskDependedOnByTaskEdgeType' => 'PhabricatorEdgeType',
|
||||||
'ManiphestTaskDependsOnTaskEdgeType' => 'PhabricatorEdgeType',
|
'ManiphestTaskDependsOnTaskEdgeType' => 'PhabricatorEdgeType',
|
||||||
|
'ManiphestTaskDescriptionHeraldField' => 'ManiphestTaskHeraldField',
|
||||||
'ManiphestTaskDetailController' => 'ManiphestController',
|
'ManiphestTaskDetailController' => 'ManiphestController',
|
||||||
'ManiphestTaskEditBulkJobType' => 'PhabricatorWorkerBulkJobType',
|
'ManiphestTaskEditBulkJobType' => 'PhabricatorWorkerBulkJobType',
|
||||||
'ManiphestTaskEditController' => 'ManiphestController',
|
'ManiphestTaskEditController' => 'ManiphestController',
|
||||||
'ManiphestTaskHasCommitEdgeType' => 'PhabricatorEdgeType',
|
'ManiphestTaskHasCommitEdgeType' => 'PhabricatorEdgeType',
|
||||||
'ManiphestTaskHasMockEdgeType' => 'PhabricatorEdgeType',
|
'ManiphestTaskHasMockEdgeType' => 'PhabricatorEdgeType',
|
||||||
'ManiphestTaskHasRevisionEdgeType' => 'PhabricatorEdgeType',
|
'ManiphestTaskHasRevisionEdgeType' => 'PhabricatorEdgeType',
|
||||||
|
'ManiphestTaskHeraldField' => 'HeraldField',
|
||||||
'ManiphestTaskListController' => 'ManiphestController',
|
'ManiphestTaskListController' => 'ManiphestController',
|
||||||
'ManiphestTaskListView' => 'ManiphestView',
|
'ManiphestTaskListView' => 'ManiphestView',
|
||||||
'ManiphestTaskMailReceiver' => 'PhabricatorObjectMailReceiver',
|
'ManiphestTaskMailReceiver' => 'PhabricatorObjectMailReceiver',
|
||||||
|
@ -4653,16 +4660,17 @@ phutil_register_library_map(array(
|
||||||
'ManiphestTaskPHIDType' => 'PhabricatorPHIDType',
|
'ManiphestTaskPHIDType' => 'PhabricatorPHIDType',
|
||||||
'ManiphestTaskPriority' => 'ManiphestConstants',
|
'ManiphestTaskPriority' => 'ManiphestConstants',
|
||||||
'ManiphestTaskPriorityDatasource' => 'PhabricatorTypeaheadDatasource',
|
'ManiphestTaskPriorityDatasource' => 'PhabricatorTypeaheadDatasource',
|
||||||
'ManiphestTaskPriorityHeraldField' => 'ManiphestHeraldField',
|
'ManiphestTaskPriorityHeraldField' => 'ManiphestTaskHeraldField',
|
||||||
'ManiphestTaskQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
'ManiphestTaskQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
||||||
'ManiphestTaskResultListView' => 'ManiphestView',
|
'ManiphestTaskResultListView' => 'ManiphestView',
|
||||||
'ManiphestTaskSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
'ManiphestTaskSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
||||||
'ManiphestTaskStatus' => 'ManiphestConstants',
|
'ManiphestTaskStatus' => 'ManiphestConstants',
|
||||||
'ManiphestTaskStatusDatasource' => 'PhabricatorTypeaheadDatasource',
|
'ManiphestTaskStatusDatasource' => 'PhabricatorTypeaheadDatasource',
|
||||||
'ManiphestTaskStatusFunctionDatasource' => 'PhabricatorTypeaheadCompositeDatasource',
|
'ManiphestTaskStatusFunctionDatasource' => 'PhabricatorTypeaheadCompositeDatasource',
|
||||||
'ManiphestTaskStatusHeraldField' => 'ManiphestHeraldField',
|
'ManiphestTaskStatusHeraldField' => 'ManiphestTaskHeraldField',
|
||||||
'ManiphestTaskStatusTestCase' => 'PhabricatorTestCase',
|
'ManiphestTaskStatusTestCase' => 'PhabricatorTestCase',
|
||||||
'ManiphestTaskTestCase' => 'PhabricatorTestCase',
|
'ManiphestTaskTestCase' => 'PhabricatorTestCase',
|
||||||
|
'ManiphestTaskTitleHeraldField' => 'ManiphestTaskHeraldField',
|
||||||
'ManiphestTransaction' => 'PhabricatorApplicationTransaction',
|
'ManiphestTransaction' => 'PhabricatorApplicationTransaction',
|
||||||
'ManiphestTransactionComment' => 'PhabricatorApplicationTransactionComment',
|
'ManiphestTransactionComment' => 'PhabricatorApplicationTransactionComment',
|
||||||
'ManiphestTransactionEditor' => 'PhabricatorApplicationTransactionEditor',
|
'ManiphestTransactionEditor' => 'PhabricatorApplicationTransactionEditor',
|
||||||
|
|
|
@ -5,7 +5,6 @@ abstract class HeraldAdapter extends Phobject {
|
||||||
const FIELD_TITLE = 'title';
|
const FIELD_TITLE = 'title';
|
||||||
const FIELD_BODY = 'body';
|
const FIELD_BODY = 'body';
|
||||||
const FIELD_AUTHOR = 'author';
|
const FIELD_AUTHOR = 'author';
|
||||||
const FIELD_ASSIGNEE = 'assignee';
|
|
||||||
const FIELD_REVIEWER = 'reviewer';
|
const FIELD_REVIEWER = 'reviewer';
|
||||||
const FIELD_REVIEWERS = 'reviewers';
|
const FIELD_REVIEWERS = 'reviewers';
|
||||||
const FIELD_COMMITTER = 'committer';
|
const FIELD_COMMITTER = 'committer';
|
||||||
|
@ -355,7 +354,6 @@ abstract class HeraldAdapter extends Phobject {
|
||||||
self::FIELD_TITLE => pht('Title'),
|
self::FIELD_TITLE => pht('Title'),
|
||||||
self::FIELD_BODY => pht('Body'),
|
self::FIELD_BODY => pht('Body'),
|
||||||
self::FIELD_AUTHOR => pht('Author'),
|
self::FIELD_AUTHOR => pht('Author'),
|
||||||
self::FIELD_ASSIGNEE => pht('Assignee'),
|
|
||||||
self::FIELD_COMMITTER => pht('Committer'),
|
self::FIELD_COMMITTER => pht('Committer'),
|
||||||
self::FIELD_REVIEWER => pht('Reviewer'),
|
self::FIELD_REVIEWER => pht('Reviewer'),
|
||||||
self::FIELD_REVIEWERS => pht('Reviewers'),
|
self::FIELD_REVIEWERS => pht('Reviewers'),
|
||||||
|
@ -444,7 +442,6 @@ abstract class HeraldAdapter extends Phobject {
|
||||||
self::CONDITION_IS_NOT_ANY,
|
self::CONDITION_IS_NOT_ANY,
|
||||||
);
|
);
|
||||||
case self::FIELD_REPOSITORY:
|
case self::FIELD_REPOSITORY:
|
||||||
case self::FIELD_ASSIGNEE:
|
|
||||||
case self::FIELD_AUTHOR:
|
case self::FIELD_AUTHOR:
|
||||||
case self::FIELD_COMMITTER:
|
case self::FIELD_COMMITTER:
|
||||||
return array(
|
return array(
|
||||||
|
|
|
@ -6,7 +6,9 @@ abstract class HeraldField extends Phobject {
|
||||||
|
|
||||||
const STANDARD_LIST = 'standard.list';
|
const STANDARD_LIST = 'standard.list';
|
||||||
const STANDARD_BOOL = 'standard.bool';
|
const STANDARD_BOOL = 'standard.bool';
|
||||||
|
const STANDARD_TEXT = 'standard.text';
|
||||||
const STANDARD_PHID = 'standard.phid';
|
const STANDARD_PHID = 'standard.phid';
|
||||||
|
const STANDARD_PHID_NULLABLE = 'standard.phid.nullable';
|
||||||
|
|
||||||
abstract public function getHeraldFieldName();
|
abstract public function getHeraldFieldName();
|
||||||
abstract public function getHeraldFieldValue($object);
|
abstract public function getHeraldFieldValue($object);
|
||||||
|
@ -26,12 +28,26 @@ abstract class HeraldField extends Phobject {
|
||||||
HeraldAdapter::CONDITION_IS_TRUE,
|
HeraldAdapter::CONDITION_IS_TRUE,
|
||||||
HeraldAdapter::CONDITION_IS_FALSE,
|
HeraldAdapter::CONDITION_IS_FALSE,
|
||||||
);
|
);
|
||||||
|
case self::STANDARD_TEXT:
|
||||||
|
return array(
|
||||||
|
HeraldAdapter::CONDITION_CONTAINS,
|
||||||
|
HeraldAdapter::CONDITION_NOT_CONTAINS,
|
||||||
|
HeraldAdapter::CONDITION_IS,
|
||||||
|
HeraldAdapter::CONDITION_IS_NOT,
|
||||||
|
HeraldAdapter::CONDITION_REGEXP,
|
||||||
|
);
|
||||||
case self::STANDARD_PHID:
|
case self::STANDARD_PHID:
|
||||||
return array(
|
return array(
|
||||||
HeraldAdapter::CONDITION_IS_ANY,
|
HeraldAdapter::CONDITION_IS_ANY,
|
||||||
HeraldAdapter::CONDITION_IS_NOT_ANY,
|
HeraldAdapter::CONDITION_IS_NOT_ANY,
|
||||||
);
|
);
|
||||||
|
case self::STANDARD_PHID_NULLABLE:
|
||||||
|
return array(
|
||||||
|
HeraldAdapter::CONDITION_IS_ANY,
|
||||||
|
HeraldAdapter::CONDITION_IS_NOT_ANY,
|
||||||
|
HeraldAdapter::CONDITION_EXISTS,
|
||||||
|
HeraldAdapter::CONDITION_NOT_EXISTS,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new Exception(pht('Unknown standard condition set.'));
|
throw new Exception(pht('Unknown standard condition set.'));
|
||||||
|
|
|
@ -67,17 +67,6 @@ final class HeraldManiphestTaskAdapter extends HeraldAdapter {
|
||||||
return pht('Maniphest Tasks');
|
return pht('Maniphest Tasks');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFields() {
|
|
||||||
return array_merge(
|
|
||||||
array(
|
|
||||||
self::FIELD_TITLE,
|
|
||||||
self::FIELD_BODY,
|
|
||||||
self::FIELD_AUTHOR,
|
|
||||||
self::FIELD_ASSIGNEE,
|
|
||||||
),
|
|
||||||
parent::getFields());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getActions($rule_type) {
|
public function getActions($rule_type) {
|
||||||
switch ($rule_type) {
|
switch ($rule_type) {
|
||||||
case HeraldRuleTypeConfig::RULE_TYPE_GLOBAL:
|
case HeraldRuleTypeConfig::RULE_TYPE_GLOBAL:
|
||||||
|
@ -112,21 +101,6 @@ final class HeraldManiphestTaskAdapter extends HeraldAdapter {
|
||||||
return 'T'.$this->getTask()->getID();
|
return 'T'.$this->getTask()->getID();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHeraldField($field) {
|
|
||||||
switch ($field) {
|
|
||||||
case self::FIELD_TITLE:
|
|
||||||
return $this->getTask()->getTitle();
|
|
||||||
case self::FIELD_BODY:
|
|
||||||
return $this->getTask()->getDescription();
|
|
||||||
case self::FIELD_AUTHOR:
|
|
||||||
return $this->getTask()->getAuthorPHID();
|
|
||||||
case self::FIELD_ASSIGNEE:
|
|
||||||
return $this->getTask()->getOwnerPHID();
|
|
||||||
}
|
|
||||||
|
|
||||||
return parent::getHeraldField($field);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function applyHeraldEffects(array $effects) {
|
public function applyHeraldEffects(array $effects) {
|
||||||
assert_instances_of($effects, 'HeraldEffect');
|
assert_instances_of($effects, 'HeraldEffect');
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class ManiphestTaskAssigneeHeraldField
|
||||||
|
extends ManiphestTaskHeraldField {
|
||||||
|
|
||||||
|
const FIELDCONST = 'maniphest.task.assignee';
|
||||||
|
|
||||||
|
public function getHeraldFieldName() {
|
||||||
|
return pht('Assignee');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getHeraldFieldValue($object) {
|
||||||
|
return $object->getOwnerPHID();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getHeraldFieldStandardConditions() {
|
||||||
|
return self::STANDARD_PHID_NULLABLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getHeraldFieldValueType($condition) {
|
||||||
|
return HeraldAdapter::VALUE_USER;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class ManiphestTaskAuthorHeraldField
|
||||||
|
extends ManiphestTaskHeraldField {
|
||||||
|
|
||||||
|
const FIELDCONST = 'maniphest.task.author';
|
||||||
|
|
||||||
|
public function getHeraldFieldName() {
|
||||||
|
return pht('Author');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getHeraldFieldValue($object) {
|
||||||
|
return $object->getAuthorPHID();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getHeraldFieldStandardConditions() {
|
||||||
|
return self::STANDARD_PHID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getHeraldFieldValueType($condition) {
|
||||||
|
return HeraldAdapter::VALUE_USER;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class ManiphestTaskDescriptionHeraldField
|
||||||
|
extends ManiphestTaskHeraldField {
|
||||||
|
|
||||||
|
const FIELDCONST = 'maniphest.task.description';
|
||||||
|
|
||||||
|
public function getHeraldFieldName() {
|
||||||
|
return pht('Description');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getHeraldFieldValue($object) {
|
||||||
|
return $object->getDescription();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getHeraldFieldStandardConditions() {
|
||||||
|
return self::STANDARD_TEXT;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getHeraldFieldValueType($condition) {
|
||||||
|
return HeraldAdapter::VALUE_TEXT;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
abstract class ManiphestHeraldField extends HeraldField {
|
abstract class ManiphestTaskHeraldField extends HeraldField {
|
||||||
|
|
||||||
public function supportsObject($object) {
|
public function supportsObject($object) {
|
||||||
return ($object instanceof ManiphestTask);
|
return ($object instanceof ManiphestTask);
|
|
@ -1,12 +1,12 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
final class ManiphestTaskPriorityHeraldField
|
final class ManiphestTaskPriorityHeraldField
|
||||||
extends ManiphestHeraldField {
|
extends ManiphestTaskHeraldField {
|
||||||
|
|
||||||
const FIELDCONST = 'taskpriority';
|
const FIELDCONST = 'taskpriority';
|
||||||
|
|
||||||
public function getHeraldFieldName() {
|
public function getHeraldFieldName() {
|
||||||
return pht('Task priority');
|
return pht('Priority');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHeraldFieldValue($object) {
|
public function getHeraldFieldValue($object) {
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
final class ManiphestTaskStatusHeraldField
|
final class ManiphestTaskStatusHeraldField
|
||||||
extends ManiphestHeraldField {
|
extends ManiphestTaskHeraldField {
|
||||||
|
|
||||||
const FIELDCONST = 'taskstatus';
|
const FIELDCONST = 'taskstatus';
|
||||||
|
|
||||||
public function getHeraldFieldName() {
|
public function getHeraldFieldName() {
|
||||||
return pht('Task status');
|
return pht('Status');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHeraldFieldValue($object) {
|
public function getHeraldFieldValue($object) {
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class ManiphestTaskTitleHeraldField
|
||||||
|
extends ManiphestTaskHeraldField {
|
||||||
|
|
||||||
|
const FIELDCONST = 'maniphest.task.title';
|
||||||
|
|
||||||
|
public function getHeraldFieldName() {
|
||||||
|
return pht('Title');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getHeraldFieldValue($object) {
|
||||||
|
return $object->getTitle();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getHeraldFieldStandardConditions() {
|
||||||
|
return self::STANDARD_TEXT;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getHeraldFieldValueType($condition) {
|
||||||
|
return HeraldAdapter::VALUE_TEXT;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue