Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15394553
D13501.id32656.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
12 KB
Referenced Files
None
Subscribers
None
D13501.id32656.diff
View Options
diff --git a/resources/sql/autopatches/20150630.herald.2.sql b/resources/sql/autopatches/20150630.herald.2.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20150630.herald.2.sql
@@ -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.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.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.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.assignee'
+ WHERE r.contentType = 'HeraldManiphestTaskAdapter'
+ AND c.fieldName = 'assignee';
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -1085,10 +1085,13 @@
'ManiphestStatusEmailCommand' => 'applications/maniphest/command/ManiphestStatusEmailCommand.php',
'ManiphestSubpriorityController' => 'applications/maniphest/controller/ManiphestSubpriorityController.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',
'ManiphestTaskClosedStatusDatasource' => 'applications/maniphest/typeahead/ManiphestTaskClosedStatusDatasource.php',
'ManiphestTaskDependedOnByTaskEdgeType' => 'applications/maniphest/edge/ManiphestTaskDependedOnByTaskEdgeType.php',
'ManiphestTaskDependsOnTaskEdgeType' => 'applications/maniphest/edge/ManiphestTaskDependsOnTaskEdgeType.php',
+ 'ManiphestTaskDescriptionHeraldField' => 'applications/maniphest/herald/ManiphestTaskDescriptionHeraldField.php',
'ManiphestTaskDetailController' => 'applications/maniphest/controller/ManiphestTaskDetailController.php',
'ManiphestTaskEditBulkJobType' => 'applications/maniphest/bulk/ManiphestTaskEditBulkJobType.php',
'ManiphestTaskEditController' => 'applications/maniphest/controller/ManiphestTaskEditController.php',
@@ -1112,6 +1115,7 @@
'ManiphestTaskStatusHeraldField' => 'applications/maniphest/herald/ManiphestTaskStatusHeraldField.php',
'ManiphestTaskStatusTestCase' => 'applications/maniphest/constants/__tests__/ManiphestTaskStatusTestCase.php',
'ManiphestTaskTestCase' => 'applications/maniphest/__tests__/ManiphestTaskTestCase.php',
+ 'ManiphestTaskTitleHeraldField' => 'applications/maniphest/herald/ManiphestTaskTitleHeraldField.php',
'ManiphestTransaction' => 'applications/maniphest/storage/ManiphestTransaction.php',
'ManiphestTransactionComment' => 'applications/maniphest/storage/ManiphestTransactionComment.php',
'ManiphestTransactionEditor' => 'applications/maniphest/editor/ManiphestTransactionEditor.php',
@@ -4629,10 +4633,13 @@
'PhabricatorProjectInterface',
'PhabricatorSpacesInterface',
),
+ 'ManiphestTaskAssigneeHeraldField' => 'ManiphestHeraldField',
+ 'ManiphestTaskAuthorHeraldField' => 'ManiphestHeraldField',
'ManiphestTaskAuthorPolicyRule' => 'PhabricatorPolicyRule',
'ManiphestTaskClosedStatusDatasource' => 'PhabricatorTypeaheadDatasource',
'ManiphestTaskDependedOnByTaskEdgeType' => 'PhabricatorEdgeType',
'ManiphestTaskDependsOnTaskEdgeType' => 'PhabricatorEdgeType',
+ 'ManiphestTaskDescriptionHeraldField' => 'ManiphestHeraldField',
'ManiphestTaskDetailController' => 'ManiphestController',
'ManiphestTaskEditBulkJobType' => 'PhabricatorWorkerBulkJobType',
'ManiphestTaskEditController' => 'ManiphestController',
@@ -4656,6 +4663,7 @@
'ManiphestTaskStatusHeraldField' => 'ManiphestHeraldField',
'ManiphestTaskStatusTestCase' => 'PhabricatorTestCase',
'ManiphestTaskTestCase' => 'PhabricatorTestCase',
+ 'ManiphestTaskTitleHeraldField' => 'ManiphestHeraldField',
'ManiphestTransaction' => 'PhabricatorApplicationTransaction',
'ManiphestTransactionComment' => 'PhabricatorApplicationTransactionComment',
'ManiphestTransactionEditor' => 'PhabricatorApplicationTransactionEditor',
diff --git a/src/applications/herald/adapter/HeraldAdapter.php b/src/applications/herald/adapter/HeraldAdapter.php
--- a/src/applications/herald/adapter/HeraldAdapter.php
+++ b/src/applications/herald/adapter/HeraldAdapter.php
@@ -5,7 +5,6 @@
const FIELD_TITLE = 'title';
const FIELD_BODY = 'body';
const FIELD_AUTHOR = 'author';
- const FIELD_ASSIGNEE = 'assignee';
const FIELD_REVIEWER = 'reviewer';
const FIELD_REVIEWERS = 'reviewers';
const FIELD_COMMITTER = 'committer';
@@ -355,7 +354,6 @@
self::FIELD_TITLE => pht('Title'),
self::FIELD_BODY => pht('Body'),
self::FIELD_AUTHOR => pht('Author'),
- self::FIELD_ASSIGNEE => pht('Assignee'),
self::FIELD_COMMITTER => pht('Committer'),
self::FIELD_REVIEWER => pht('Reviewer'),
self::FIELD_REVIEWERS => pht('Reviewers'),
@@ -444,7 +442,6 @@
self::CONDITION_IS_NOT_ANY,
);
case self::FIELD_REPOSITORY:
- case self::FIELD_ASSIGNEE:
case self::FIELD_AUTHOR:
case self::FIELD_COMMITTER:
return array(
diff --git a/src/applications/herald/field/HeraldField.php b/src/applications/herald/field/HeraldField.php
--- a/src/applications/herald/field/HeraldField.php
+++ b/src/applications/herald/field/HeraldField.php
@@ -6,7 +6,9 @@
const STANDARD_LIST = 'standard.list';
const STANDARD_BOOL = 'standard.bool';
+ const STANDARD_TEXT = 'standard.text';
const STANDARD_PHID = 'standard.phid';
+ const STANDARD_PHID_NULLABLE = 'standard.phid.nullable';
abstract public function getHeraldFieldName();
abstract public function getHeraldFieldValue($object);
@@ -26,12 +28,26 @@
HeraldAdapter::CONDITION_IS_TRUE,
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:
return array(
HeraldAdapter::CONDITION_IS_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.'));
diff --git a/src/applications/maniphest/herald/HeraldManiphestTaskAdapter.php b/src/applications/maniphest/herald/HeraldManiphestTaskAdapter.php
--- a/src/applications/maniphest/herald/HeraldManiphestTaskAdapter.php
+++ b/src/applications/maniphest/herald/HeraldManiphestTaskAdapter.php
@@ -67,17 +67,6 @@
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) {
switch ($rule_type) {
case HeraldRuleTypeConfig::RULE_TYPE_GLOBAL:
@@ -112,21 +101,6 @@
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) {
assert_instances_of($effects, 'HeraldEffect');
diff --git a/src/applications/maniphest/herald/ManiphestTaskAssigneeHeraldField.php b/src/applications/maniphest/herald/ManiphestTaskAssigneeHeraldField.php
new file mode 100644
--- /dev/null
+++ b/src/applications/maniphest/herald/ManiphestTaskAssigneeHeraldField.php
@@ -0,0 +1,24 @@
+<?php
+
+final class ManiphestTaskAssigneeHeraldField
+ extends ManiphestHeraldField {
+
+ const FIELDCONST = 'maniphest.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;
+ }
+
+}
diff --git a/src/applications/maniphest/herald/ManiphestTaskAuthorHeraldField.php b/src/applications/maniphest/herald/ManiphestTaskAuthorHeraldField.php
new file mode 100644
--- /dev/null
+++ b/src/applications/maniphest/herald/ManiphestTaskAuthorHeraldField.php
@@ -0,0 +1,24 @@
+<?php
+
+final class ManiphestTaskAuthorHeraldField
+ extends ManiphestHeraldField {
+
+ const FIELDCONST = 'maniphest.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;
+ }
+
+}
diff --git a/src/applications/maniphest/herald/ManiphestTaskDescriptionHeraldField.php b/src/applications/maniphest/herald/ManiphestTaskDescriptionHeraldField.php
new file mode 100644
--- /dev/null
+++ b/src/applications/maniphest/herald/ManiphestTaskDescriptionHeraldField.php
@@ -0,0 +1,24 @@
+<?php
+
+final class ManiphestTaskDescriptionHeraldField
+ extends ManiphestHeraldField {
+
+ const FIELDCONST = 'maniphest.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;
+ }
+
+}
diff --git a/src/applications/maniphest/herald/ManiphestTaskPriorityHeraldField.php b/src/applications/maniphest/herald/ManiphestTaskPriorityHeraldField.php
--- a/src/applications/maniphest/herald/ManiphestTaskPriorityHeraldField.php
+++ b/src/applications/maniphest/herald/ManiphestTaskPriorityHeraldField.php
@@ -6,7 +6,7 @@
const FIELDCONST = 'taskpriority';
public function getHeraldFieldName() {
- return pht('Task priority');
+ return pht('Priority');
}
public function getHeraldFieldValue($object) {
diff --git a/src/applications/maniphest/herald/ManiphestTaskStatusHeraldField.php b/src/applications/maniphest/herald/ManiphestTaskStatusHeraldField.php
--- a/src/applications/maniphest/herald/ManiphestTaskStatusHeraldField.php
+++ b/src/applications/maniphest/herald/ManiphestTaskStatusHeraldField.php
@@ -6,7 +6,7 @@
const FIELDCONST = 'taskstatus';
public function getHeraldFieldName() {
- return pht('Task status');
+ return pht('Status');
}
public function getHeraldFieldValue($object) {
diff --git a/src/applications/maniphest/herald/ManiphestTaskTitleHeraldField.php b/src/applications/maniphest/herald/ManiphestTaskTitleHeraldField.php
new file mode 100644
--- /dev/null
+++ b/src/applications/maniphest/herald/ManiphestTaskTitleHeraldField.php
@@ -0,0 +1,24 @@
+<?php
+
+final class ManiphestTaskTitleHeraldField
+ extends ManiphestHeraldField {
+
+ const FIELDCONST = 'maniphest.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;
+ }
+
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Mar 16, 11:55 PM (3 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7707881
Default Alt Text
D13501.id32656.diff (12 KB)
Attached To
Mode
D13501: Modularize all remaining Maniphest Herald fields
Attached
Detach File
Event Timeline
Log In to Comment