Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13298618
D13616.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
52 KB
Referenced Files
None
Subscribers
None
D13616.diff
View Options
diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -382,7 +382,7 @@
'rsrc/js/application/doorkeeper/behavior-doorkeeper-tag.js' => 'e5822781',
'rsrc/js/application/files/behavior-icon-composer.js' => '8ef9ab58',
'rsrc/js/application/files/behavior-launch-icon-composer.js' => '48086888',
- 'rsrc/js/application/herald/HeraldRuleEditor.js' => '797e4876',
+ 'rsrc/js/application/herald/HeraldRuleEditor.js' => '6c2dffcc',
'rsrc/js/application/herald/PathTypeahead.js' => 'f7fc67ec',
'rsrc/js/application/herald/herald-rule-editor.js' => '7ebaeed3',
'rsrc/js/application/maniphest/behavior-batch-editor.js' => '782ab6e7',
@@ -538,7 +538,7 @@
'global-drag-and-drop-css' => '697324ad',
'harbormaster-css' => '49d64eb4',
'herald-css' => '826075fa',
- 'herald-rule-editor' => '797e4876',
+ 'herald-rule-editor' => '6c2dffcc',
'herald-test-css' => '778b008e',
'inline-comment-summary-css' => '51efda3a',
'javelin-aphlict' => '5359e785',
@@ -1338,6 +1338,15 @@
'javelin-install',
'javelin-util',
),
+ '6c2dffcc' => array(
+ 'multirow-row-manager',
+ 'javelin-install',
+ 'javelin-util',
+ 'javelin-dom',
+ 'javelin-stratcom',
+ 'javelin-json',
+ 'phabricator-prefab',
+ ),
'6c53634d' => array(
'javelin-install',
'javelin-event',
@@ -1416,15 +1425,6 @@
'javelin-behavior',
'javelin-quicksand',
),
- '797e4876' => array(
- 'multirow-row-manager',
- 'javelin-install',
- 'javelin-util',
- 'javelin-dom',
- 'javelin-stratcom',
- 'javelin-json',
- 'phabricator-prefab',
- ),
'7a68dda3' => array(
'owners-path-editor',
'javelin-behavior',
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
@@ -1057,6 +1057,7 @@
'HeraldSubscribersField' => 'applications/subscriptions/herald/HeraldSubscribersField.php',
'HeraldTestConsoleController' => 'applications/herald/controller/HeraldTestConsoleController.php',
'HeraldTextFieldValue' => 'applications/herald/value/HeraldTextFieldValue.php',
+ 'HeraldTokenizerFieldValue' => 'applications/herald/value/HeraldTokenizerFieldValue.php',
'HeraldTransactionQuery' => 'applications/herald/query/HeraldTransactionQuery.php',
'HeraldTranscript' => 'applications/herald/storage/transcript/HeraldTranscript.php',
'HeraldTranscriptController' => 'applications/herald/controller/HeraldTranscriptController.php',
@@ -4664,6 +4665,7 @@
'HeraldSubscribersField' => 'HeraldField',
'HeraldTestConsoleController' => 'HeraldController',
'HeraldTextFieldValue' => 'HeraldFieldValue',
+ 'HeraldTokenizerFieldValue' => 'HeraldFieldValue',
'HeraldTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
'HeraldTranscript' => array(
'HeraldDAO',
diff --git a/src/applications/differential/herald/DifferentialDiffAuthorHeraldField.php b/src/applications/differential/herald/DifferentialDiffAuthorHeraldField.php
--- a/src/applications/differential/herald/DifferentialDiffAuthorHeraldField.php
+++ b/src/applications/differential/herald/DifferentialDiffAuthorHeraldField.php
@@ -17,8 +17,8 @@
return self::STANDARD_PHID;
}
- public function getHeraldFieldValueType($condition) {
- return HeraldAdapter::VALUE_USER;
+ protected function getDatasource() {
+ return new PhabricatorPeopleDatasource();
}
}
diff --git a/src/applications/differential/herald/DifferentialDiffAuthorProjectsHeraldField.php b/src/applications/differential/herald/DifferentialDiffAuthorProjectsHeraldField.php
--- a/src/applications/differential/herald/DifferentialDiffAuthorProjectsHeraldField.php
+++ b/src/applications/differential/herald/DifferentialDiffAuthorProjectsHeraldField.php
@@ -19,14 +19,8 @@
return self::STANDARD_PHID_LIST;
}
- public function getHeraldFieldValueType($condition) {
- switch ($condition) {
- case HeraldAdapter::CONDITION_EXISTS:
- case HeraldAdapter::CONDITION_NOT_EXISTS:
- return HeraldAdapter::VALUE_NONE;
- default:
- return HeraldAdapter::VALUE_PROJECT;
- }
+ protected function getDatasource() {
+ return new PhabricatorProjectOrUserDatasource();
}
}
diff --git a/src/applications/differential/herald/DifferentialDiffRepositoryHeraldField.php b/src/applications/differential/herald/DifferentialDiffRepositoryHeraldField.php
--- a/src/applications/differential/herald/DifferentialDiffRepositoryHeraldField.php
+++ b/src/applications/differential/herald/DifferentialDiffRepositoryHeraldField.php
@@ -23,14 +23,8 @@
return self::STANDARD_PHID_NULLABLE;
}
- public function getHeraldFieldValueType($condition) {
- switch ($condition) {
- case HeraldAdapter::CONDITION_EXISTS:
- case HeraldAdapter::CONDITION_NOT_EXISTS:
- return HeraldAdapter::VALUE_NONE;
- default:
- return HeraldAdapter::VALUE_REPOSITORY;
- }
+ protected function getDatasource() {
+ return new DiffusionRepositoryDatasource();
}
}
diff --git a/src/applications/differential/herald/DifferentialDiffRepositoryProjectsHeraldField.php b/src/applications/differential/herald/DifferentialDiffRepositoryProjectsHeraldField.php
--- a/src/applications/differential/herald/DifferentialDiffRepositoryProjectsHeraldField.php
+++ b/src/applications/differential/herald/DifferentialDiffRepositoryProjectsHeraldField.php
@@ -24,14 +24,8 @@
return self::STANDARD_PHID_LIST;
}
- public function getHeraldFieldValueType($condition) {
- switch ($condition) {
- case HeraldAdapter::CONDITION_EXISTS:
- case HeraldAdapter::CONDITION_NOT_EXISTS:
- return HeraldAdapter::VALUE_NONE;
- default:
- return HeraldAdapter::VALUE_PROJECT;
- }
+ protected function getDatasource() {
+ return new PhabricatorProjectDatasource();
}
}
diff --git a/src/applications/differential/herald/DifferentialRevisionAuthorHeraldField.php b/src/applications/differential/herald/DifferentialRevisionAuthorHeraldField.php
--- a/src/applications/differential/herald/DifferentialRevisionAuthorHeraldField.php
+++ b/src/applications/differential/herald/DifferentialRevisionAuthorHeraldField.php
@@ -17,8 +17,8 @@
return self::STANDARD_PHID;
}
- public function getHeraldFieldValueType($condition) {
- return HeraldAdapter::VALUE_USER;
+ protected function getDatasource() {
+ return new PhabricatorPeopleDatasource();
}
}
diff --git a/src/applications/differential/herald/DifferentialRevisionAuthorProjectsHeraldField.php b/src/applications/differential/herald/DifferentialRevisionAuthorProjectsHeraldField.php
--- a/src/applications/differential/herald/DifferentialRevisionAuthorProjectsHeraldField.php
+++ b/src/applications/differential/herald/DifferentialRevisionAuthorProjectsHeraldField.php
@@ -19,14 +19,8 @@
return self::STANDARD_PHID_LIST;
}
- public function getHeraldFieldValueType($condition) {
- switch ($condition) {
- case HeraldAdapter::CONDITION_EXISTS:
- case HeraldAdapter::CONDITION_NOT_EXISTS:
- return HeraldAdapter::VALUE_NONE;
- default:
- return HeraldAdapter::VALUE_PROJECT;
- }
+ protected function getDatasource() {
+ return new PhabricatorProjectDatasource();
}
}
diff --git a/src/applications/differential/herald/DifferentialRevisionPackageHeraldField.php b/src/applications/differential/herald/DifferentialRevisionPackageHeraldField.php
--- a/src/applications/differential/herald/DifferentialRevisionPackageHeraldField.php
+++ b/src/applications/differential/herald/DifferentialRevisionPackageHeraldField.php
@@ -18,14 +18,8 @@
return self::STANDARD_PHID_LIST;
}
- public function getHeraldFieldValueType($condition) {
- switch ($condition) {
- case HeraldAdapter::CONDITION_EXISTS:
- case HeraldAdapter::CONDITION_NOT_EXISTS:
- return HeraldAdapter::VALUE_NONE;
- default:
- return HeraldAdapter::VALUE_OWNERS_PACKAGE;
- }
+ protected function getDatasource() {
+ return new PhabricatorOwnersPackageDatasource();
}
}
diff --git a/src/applications/differential/herald/DifferentialRevisionPackageOwnerHeraldField.php b/src/applications/differential/herald/DifferentialRevisionPackageOwnerHeraldField.php
--- a/src/applications/differential/herald/DifferentialRevisionPackageOwnerHeraldField.php
+++ b/src/applications/differential/herald/DifferentialRevisionPackageOwnerHeraldField.php
@@ -23,14 +23,8 @@
return self::STANDARD_PHID_LIST;
}
- public function getHeraldFieldValueType($condition) {
- switch ($condition) {
- case HeraldAdapter::CONDITION_EXISTS:
- case HeraldAdapter::CONDITION_NOT_EXISTS:
- return HeraldAdapter::VALUE_NONE;
- default:
- return HeraldAdapter::VALUE_USER_OR_PROJECT;
- }
+ protected function getDatasource() {
+ return new PhabricatorProjectOrUserDatasource();
}
}
diff --git a/src/applications/differential/herald/DifferentialRevisionRepositoryHeraldField.php b/src/applications/differential/herald/DifferentialRevisionRepositoryHeraldField.php
--- a/src/applications/differential/herald/DifferentialRevisionRepositoryHeraldField.php
+++ b/src/applications/differential/herald/DifferentialRevisionRepositoryHeraldField.php
@@ -23,14 +23,8 @@
return self::STANDARD_PHID_NULLABLE;
}
- public function getHeraldFieldValueType($condition) {
- switch ($condition) {
- case HeraldAdapter::CONDITION_EXISTS:
- case HeraldAdapter::CONDITION_NOT_EXISTS:
- return HeraldAdapter::VALUE_NONE;
- default:
- return HeraldAdapter::VALUE_REPOSITORY;
- }
+ protected function getDatasource() {
+ return new DiffusionRepositoryDatasource();
}
}
diff --git a/src/applications/differential/herald/DifferentialRevisionRepositoryProjectsHeraldField.php b/src/applications/differential/herald/DifferentialRevisionRepositoryProjectsHeraldField.php
--- a/src/applications/differential/herald/DifferentialRevisionRepositoryProjectsHeraldField.php
+++ b/src/applications/differential/herald/DifferentialRevisionRepositoryProjectsHeraldField.php
@@ -24,14 +24,8 @@
return self::STANDARD_PHID_LIST;
}
- public function getHeraldFieldValueType($condition) {
- switch ($condition) {
- case HeraldAdapter::CONDITION_EXISTS:
- case HeraldAdapter::CONDITION_NOT_EXISTS:
- return HeraldAdapter::VALUE_NONE;
- default:
- return HeraldAdapter::VALUE_PROJECT;
- }
+ protected function getDatasource() {
+ return new PhabricatorProjectDatasource();
}
}
diff --git a/src/applications/differential/herald/DifferentialRevisionReviewersHeraldField.php b/src/applications/differential/herald/DifferentialRevisionReviewersHeraldField.php
--- a/src/applications/differential/herald/DifferentialRevisionReviewersHeraldField.php
+++ b/src/applications/differential/herald/DifferentialRevisionReviewersHeraldField.php
@@ -17,14 +17,8 @@
return self::STANDARD_PHID_LIST;
}
- public function getHeraldFieldValueType($condition) {
- switch ($condition) {
- case HeraldAdapter::CONDITION_EXISTS:
- case HeraldAdapter::CONDITION_NOT_EXISTS:
- return HeraldAdapter::VALUE_NONE;
- default:
- return HeraldAdapter::VALUE_USER_OR_PROJECT;
- }
+ protected function getDatasource() {
+ return new PhabricatorProjectOrUserDatasource();
}
}
diff --git a/src/applications/diffusion/herald/DiffusionCommitAuthorHeraldField.php b/src/applications/diffusion/herald/DiffusionCommitAuthorHeraldField.php
--- a/src/applications/diffusion/herald/DiffusionCommitAuthorHeraldField.php
+++ b/src/applications/diffusion/herald/DiffusionCommitAuthorHeraldField.php
@@ -17,14 +17,8 @@
return self::STANDARD_PHID_NULLABLE;
}
- public function getHeraldFieldValueType($condition) {
- switch ($condition) {
- case HeraldAdapter::CONDITION_EXISTS:
- case HeraldAdapter::CONDITION_NOT_EXISTS:
- return HeraldAdapter::VALUE_NONE;
- default:
- return HeraldAdapter::VALUE_USER;
- }
+ protected function getDatasource() {
+ return new PhabricatorPeopleDatasource();
}
}
diff --git a/src/applications/diffusion/herald/DiffusionCommitAutocloseHeraldField.php b/src/applications/diffusion/herald/DiffusionCommitAutocloseHeraldField.php
--- a/src/applications/diffusion/herald/DiffusionCommitAutocloseHeraldField.php
+++ b/src/applications/diffusion/herald/DiffusionCommitAutocloseHeraldField.php
@@ -20,7 +20,7 @@
}
public function getHeraldFieldValueType($condition) {
- return HeraldAdapter::VALUE_NONE;
+ return new HeraldEmptyFieldValue();
}
}
diff --git a/src/applications/diffusion/herald/DiffusionCommitCommitterHeraldField.php b/src/applications/diffusion/herald/DiffusionCommitCommitterHeraldField.php
--- a/src/applications/diffusion/herald/DiffusionCommitCommitterHeraldField.php
+++ b/src/applications/diffusion/herald/DiffusionCommitCommitterHeraldField.php
@@ -17,14 +17,8 @@
return self::STANDARD_PHID_NULLABLE;
}
- public function getHeraldFieldValueType($condition) {
- switch ($condition) {
- case HeraldAdapter::CONDITION_EXISTS:
- case HeraldAdapter::CONDITION_NOT_EXISTS:
- return HeraldAdapter::VALUE_NONE;
- default:
- return HeraldAdapter::VALUE_USER;
- }
+ protected function getDatasource() {
+ return new PhabricatorPeopleDatasource();
}
}
diff --git a/src/applications/diffusion/herald/DiffusionCommitPackageAuditHeraldField.php b/src/applications/diffusion/herald/DiffusionCommitPackageAuditHeraldField.php
--- a/src/applications/diffusion/herald/DiffusionCommitPackageAuditHeraldField.php
+++ b/src/applications/diffusion/herald/DiffusionCommitPackageAuditHeraldField.php
@@ -22,14 +22,8 @@
return self::STANDARD_PHID_LIST;
}
- public function getHeraldFieldValueType($condition) {
- switch ($condition) {
- case HeraldAdapter::CONDITION_EXISTS:
- case HeraldAdapter::CONDITION_NOT_EXISTS:
- return HeraldAdapter::VALUE_NONE;
- default:
- return HeraldAdapter::VALUE_OWNERS_PACKAGE;
- }
+ protected function getDatasource() {
+ return new PhabricatorOwnersPackageDatasource();
}
}
diff --git a/src/applications/diffusion/herald/DiffusionCommitPackageHeraldField.php b/src/applications/diffusion/herald/DiffusionCommitPackageHeraldField.php
--- a/src/applications/diffusion/herald/DiffusionCommitPackageHeraldField.php
+++ b/src/applications/diffusion/herald/DiffusionCommitPackageHeraldField.php
@@ -18,14 +18,8 @@
return self::STANDARD_PHID_LIST;
}
- public function getHeraldFieldValueType($condition) {
- switch ($condition) {
- case HeraldAdapter::CONDITION_EXISTS:
- case HeraldAdapter::CONDITION_NOT_EXISTS:
- return HeraldAdapter::VALUE_NONE;
- default:
- return HeraldAdapter::VALUE_OWNERS_PACKAGE;
- }
+ protected function getDatasource() {
+ return new PhabricatorOwnersPackageDatasource();
}
}
diff --git a/src/applications/diffusion/herald/DiffusionCommitPackageOwnerHeraldField.php b/src/applications/diffusion/herald/DiffusionCommitPackageOwnerHeraldField.php
--- a/src/applications/diffusion/herald/DiffusionCommitPackageOwnerHeraldField.php
+++ b/src/applications/diffusion/herald/DiffusionCommitPackageOwnerHeraldField.php
@@ -24,14 +24,8 @@
return self::STANDARD_PHID_LIST;
}
- public function getHeraldFieldValueType($condition) {
- switch ($condition) {
- case HeraldAdapter::CONDITION_EXISTS:
- case HeraldAdapter::CONDITION_NOT_EXISTS:
- return HeraldAdapter::VALUE_NONE;
- default:
- return HeraldAdapter::VALUE_USER_OR_PROJECT;
- }
+ protected function getDatasource() {
+ return new PhabricatorProjectOrUserDatasource();
}
}
diff --git a/src/applications/diffusion/herald/DiffusionCommitRepositoryHeraldField.php b/src/applications/diffusion/herald/DiffusionCommitRepositoryHeraldField.php
--- a/src/applications/diffusion/herald/DiffusionCommitRepositoryHeraldField.php
+++ b/src/applications/diffusion/herald/DiffusionCommitRepositoryHeraldField.php
@@ -17,8 +17,8 @@
return self::STANDARD_PHID;
}
- public function getHeraldFieldValueType($condition) {
- return HeraldAdapter::VALUE_REPOSITORY;
+ protected function getDatasource() {
+ return new DiffusionRepositoryDatasource();
}
}
diff --git a/src/applications/diffusion/herald/DiffusionCommitRepositoryProjectsHeraldField.php b/src/applications/diffusion/herald/DiffusionCommitRepositoryProjectsHeraldField.php
--- a/src/applications/diffusion/herald/DiffusionCommitRepositoryProjectsHeraldField.php
+++ b/src/applications/diffusion/herald/DiffusionCommitRepositoryProjectsHeraldField.php
@@ -19,14 +19,8 @@
return self::STANDARD_PHID_LIST;
}
- public function getHeraldFieldValueType($condition) {
- switch ($condition) {
- case HeraldAdapter::CONDITION_EXISTS:
- case HeraldAdapter::CONDITION_NOT_EXISTS:
- return HeraldAdapter::VALUE_NONE;
- default:
- return HeraldAdapter::VALUE_PROJECT;
- }
+ protected function getDatasource() {
+ return new PhabricatorProjectDatasource();
}
}
diff --git a/src/applications/diffusion/herald/DiffusionCommitReviewerHeraldField.php b/src/applications/diffusion/herald/DiffusionCommitReviewerHeraldField.php
--- a/src/applications/diffusion/herald/DiffusionCommitReviewerHeraldField.php
+++ b/src/applications/diffusion/herald/DiffusionCommitReviewerHeraldField.php
@@ -17,14 +17,8 @@
return self::STANDARD_PHID_NULLABLE;
}
- public function getHeraldFieldValueType($condition) {
- switch ($condition) {
- case HeraldAdapter::CONDITION_EXISTS:
- case HeraldAdapter::CONDITION_NOT_EXISTS:
- return HeraldAdapter::VALUE_NONE;
- default:
- return HeraldAdapter::VALUE_USER;
- }
+ protected function getDatasource() {
+ return new PhabricatorPeopleDatasource();
}
}
diff --git a/src/applications/diffusion/herald/DiffusionCommitRevisionReviewersHeraldField.php b/src/applications/diffusion/herald/DiffusionCommitRevisionReviewersHeraldField.php
--- a/src/applications/diffusion/herald/DiffusionCommitRevisionReviewersHeraldField.php
+++ b/src/applications/diffusion/herald/DiffusionCommitRevisionReviewersHeraldField.php
@@ -23,14 +23,8 @@
return self::STANDARD_PHID_LIST;
}
- public function getHeraldFieldValueType($condition) {
- switch ($condition) {
- case HeraldAdapter::CONDITION_EXISTS:
- case HeraldAdapter::CONDITION_NOT_EXISTS:
- return HeraldAdapter::VALUE_NONE;
- default:
- return HeraldAdapter::VALUE_USER_OR_PROJECT;
- }
+ protected function getDatasource() {
+ return new PhabricatorProjectOrUserDatasource();
}
}
diff --git a/src/applications/diffusion/herald/DiffusionCommitRevisionSubscribersHeraldField.php b/src/applications/diffusion/herald/DiffusionCommitRevisionSubscribersHeraldField.php
--- a/src/applications/diffusion/herald/DiffusionCommitRevisionSubscribersHeraldField.php
+++ b/src/applications/diffusion/herald/DiffusionCommitRevisionSubscribersHeraldField.php
@@ -24,14 +24,8 @@
return self::STANDARD_PHID_LIST;
}
- public function getHeraldFieldValueType($condition) {
- switch ($condition) {
- case HeraldAdapter::CONDITION_EXISTS:
- case HeraldAdapter::CONDITION_NOT_EXISTS:
- return HeraldAdapter::VALUE_NONE;
- default:
- return HeraldAdapter::VALUE_USER_OR_PROJECT;
- }
+ protected function getDatasource() {
+ return new PhabricatorProjectOrUserDatasource();
}
}
diff --git a/src/applications/diffusion/herald/DiffusionPreCommitContentAuthorHeraldField.php b/src/applications/diffusion/herald/DiffusionPreCommitContentAuthorHeraldField.php
--- a/src/applications/diffusion/herald/DiffusionPreCommitContentAuthorHeraldField.php
+++ b/src/applications/diffusion/herald/DiffusionPreCommitContentAuthorHeraldField.php
@@ -17,14 +17,8 @@
return self::STANDARD_PHID_NULLABLE;
}
- public function getHeraldFieldValueType($condition) {
- switch ($condition) {
- case HeraldAdapter::CONDITION_EXISTS:
- case HeraldAdapter::CONDITION_NOT_EXISTS:
- return HeraldAdapter::VALUE_NONE;
- default:
- return HeraldAdapter::VALUE_USER;
- }
+ protected function getDatasource() {
+ return new PhabricatorPeopleDatasource();
}
}
diff --git a/src/applications/diffusion/herald/DiffusionPreCommitContentCommitterHeraldField.php b/src/applications/diffusion/herald/DiffusionPreCommitContentCommitterHeraldField.php
--- a/src/applications/diffusion/herald/DiffusionPreCommitContentCommitterHeraldField.php
+++ b/src/applications/diffusion/herald/DiffusionPreCommitContentCommitterHeraldField.php
@@ -17,14 +17,8 @@
return self::STANDARD_PHID_NULLABLE;
}
- public function getHeraldFieldValueType($condition) {
- switch ($condition) {
- case HeraldAdapter::CONDITION_EXISTS:
- case HeraldAdapter::CONDITION_NOT_EXISTS:
- return HeraldAdapter::VALUE_NONE;
- default:
- return HeraldAdapter::VALUE_USER;
- }
+ protected function getDatasource() {
+ return new PhabricatorPeopleDatasource();
}
}
diff --git a/src/applications/diffusion/herald/DiffusionPreCommitContentPusherHeraldField.php b/src/applications/diffusion/herald/DiffusionPreCommitContentPusherHeraldField.php
--- a/src/applications/diffusion/herald/DiffusionPreCommitContentPusherHeraldField.php
+++ b/src/applications/diffusion/herald/DiffusionPreCommitContentPusherHeraldField.php
@@ -17,8 +17,8 @@
return HeraldField::STANDARD_PHID;
}
- public function getHeraldFieldValueType($condition) {
- return HeraldAdapter::VALUE_USER;
+ protected function getDatasource() {
+ return new PhabricatorPeopleDatasource();
}
}
diff --git a/src/applications/diffusion/herald/DiffusionPreCommitContentPusherProjectsHeraldField.php b/src/applications/diffusion/herald/DiffusionPreCommitContentPusherProjectsHeraldField.php
--- a/src/applications/diffusion/herald/DiffusionPreCommitContentPusherProjectsHeraldField.php
+++ b/src/applications/diffusion/herald/DiffusionPreCommitContentPusherProjectsHeraldField.php
@@ -19,13 +19,8 @@
return HeraldField::STANDARD_PHID_LIST;
}
- public function getHeraldFieldValueType($condition) {
- switch ($condition) {
- case HeraldAdapter::CONDITION_EXISTS:
- case HeraldAdapter::CONDITION_NOT_EXISTS:
- return HeraldAdapter::VALUE_NONE;
- default:
- return HeraldAdapter::VALUE_PROJECT;
- }
+ protected function getDatasource() {
+ return new PhabricatorProjectDatasource();
}
+
}
diff --git a/src/applications/diffusion/herald/DiffusionPreCommitContentRepositoryHeraldField.php b/src/applications/diffusion/herald/DiffusionPreCommitContentRepositoryHeraldField.php
--- a/src/applications/diffusion/herald/DiffusionPreCommitContentRepositoryHeraldField.php
+++ b/src/applications/diffusion/herald/DiffusionPreCommitContentRepositoryHeraldField.php
@@ -17,8 +17,8 @@
return HeraldField::STANDARD_PHID;
}
- public function getHeraldFieldValueType($condition) {
- return HeraldAdapter::VALUE_REPOSITORY;
+ protected function getDatasource() {
+ return new DiffusionRepositoryDatasource();
}
}
diff --git a/src/applications/diffusion/herald/DiffusionPreCommitContentRepositoryProjectsHeraldField.php b/src/applications/diffusion/herald/DiffusionPreCommitContentRepositoryProjectsHeraldField.php
--- a/src/applications/diffusion/herald/DiffusionPreCommitContentRepositoryProjectsHeraldField.php
+++ b/src/applications/diffusion/herald/DiffusionPreCommitContentRepositoryProjectsHeraldField.php
@@ -19,14 +19,8 @@
return HeraldField::STANDARD_PHID_LIST;
}
- public function getHeraldFieldValueType($condition) {
- switch ($condition) {
- case HeraldAdapter::CONDITION_EXISTS:
- case HeraldAdapter::CONDITION_NOT_EXISTS:
- return HeraldAdapter::VALUE_NONE;
- default:
- return HeraldAdapter::VALUE_PROJECT;
- }
+ protected function getDatasource() {
+ return new PhabricatorProjectDatasource();
}
}
diff --git a/src/applications/diffusion/herald/DiffusionPreCommitContentRevisionReviewersHeraldField.php b/src/applications/diffusion/herald/DiffusionPreCommitContentRevisionReviewersHeraldField.php
--- a/src/applications/diffusion/herald/DiffusionPreCommitContentRevisionReviewersHeraldField.php
+++ b/src/applications/diffusion/herald/DiffusionPreCommitContentRevisionReviewersHeraldField.php
@@ -23,14 +23,8 @@
return self::STANDARD_PHID_LIST;
}
- public function getHeraldFieldValueType($condition) {
- switch ($condition) {
- case HeraldAdapter::CONDITION_EXISTS:
- case HeraldAdapter::CONDITION_NOT_EXISTS:
- return HeraldAdapter::VALUE_NONE;
- default:
- return HeraldAdapter::VALUE_USER_OR_PROJECT;
- }
+ protected function getDatasource() {
+ return new PhabricatorProjectOrUserDatasource();
}
}
diff --git a/src/applications/diffusion/herald/DiffusionPreCommitContentRevisionSubscribersHeraldField.php b/src/applications/diffusion/herald/DiffusionPreCommitContentRevisionSubscribersHeraldField.php
--- a/src/applications/diffusion/herald/DiffusionPreCommitContentRevisionSubscribersHeraldField.php
+++ b/src/applications/diffusion/herald/DiffusionPreCommitContentRevisionSubscribersHeraldField.php
@@ -24,14 +24,8 @@
return self::STANDARD_PHID_LIST;
}
- public function getHeraldFieldValueType($condition) {
- switch ($condition) {
- case HeraldAdapter::CONDITION_EXISTS:
- case HeraldAdapter::CONDITION_NOT_EXISTS:
- return HeraldAdapter::VALUE_NONE;
- default:
- return HeraldAdapter::VALUE_USER_OR_PROJECT;
- }
+ protected function getDatasource() {
+ return new PhabricatorProjectOrUserDatasource();
}
}
diff --git a/src/applications/diffusion/herald/DiffusionPreCommitRefPusherHeraldField.php b/src/applications/diffusion/herald/DiffusionPreCommitRefPusherHeraldField.php
--- a/src/applications/diffusion/herald/DiffusionPreCommitRefPusherHeraldField.php
+++ b/src/applications/diffusion/herald/DiffusionPreCommitRefPusherHeraldField.php
@@ -17,8 +17,8 @@
return HeraldField::STANDARD_PHID;
}
- public function getHeraldFieldValueType($condition) {
- return HeraldAdapter::VALUE_USER;
+ protected function getDatasource() {
+ return new PhabricatorPeopleDatasource();
}
}
diff --git a/src/applications/diffusion/herald/DiffusionPreCommitRefPusherProjectsHeraldField.php b/src/applications/diffusion/herald/DiffusionPreCommitRefPusherProjectsHeraldField.php
--- a/src/applications/diffusion/herald/DiffusionPreCommitRefPusherProjectsHeraldField.php
+++ b/src/applications/diffusion/herald/DiffusionPreCommitRefPusherProjectsHeraldField.php
@@ -19,13 +19,8 @@
return HeraldField::STANDARD_PHID_LIST;
}
- public function getHeraldFieldValueType($condition) {
- switch ($condition) {
- case HeraldAdapter::CONDITION_EXISTS:
- case HeraldAdapter::CONDITION_NOT_EXISTS:
- return HeraldAdapter::VALUE_NONE;
- default:
- return HeraldAdapter::VALUE_PROJECT;
- }
+ protected function getDatasource() {
+ return new PhabricatorProjectDatasource();
}
+
}
diff --git a/src/applications/diffusion/herald/DiffusionPreCommitRefRepositoryHeraldField.php b/src/applications/diffusion/herald/DiffusionPreCommitRefRepositoryHeraldField.php
--- a/src/applications/diffusion/herald/DiffusionPreCommitRefRepositoryHeraldField.php
+++ b/src/applications/diffusion/herald/DiffusionPreCommitRefRepositoryHeraldField.php
@@ -17,8 +17,8 @@
return HeraldField::STANDARD_PHID;
}
- public function getHeraldFieldValueType($condition) {
- return HeraldAdapter::VALUE_REPOSITORY;
+ protected function getDatasource() {
+ return new DiffusionRepositoryDatasource();
}
}
diff --git a/src/applications/diffusion/herald/DiffusionPreCommitRefRepositoryProjectsHeraldField.php b/src/applications/diffusion/herald/DiffusionPreCommitRefRepositoryProjectsHeraldField.php
--- a/src/applications/diffusion/herald/DiffusionPreCommitRefRepositoryProjectsHeraldField.php
+++ b/src/applications/diffusion/herald/DiffusionPreCommitRefRepositoryProjectsHeraldField.php
@@ -19,14 +19,8 @@
return HeraldField::STANDARD_PHID_LIST;
}
- public function getHeraldFieldValueType($condition) {
- switch ($condition) {
- case HeraldAdapter::CONDITION_EXISTS:
- case HeraldAdapter::CONDITION_NOT_EXISTS:
- return HeraldAdapter::VALUE_NONE;
- default:
- return HeraldAdapter::VALUE_PROJECT;
- }
+ protected function getDatasource() {
+ return new PhabricatorProjectDatasource();
}
}
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
@@ -41,21 +41,6 @@
const ACTION_BLOCK = 'block';
const ACTION_REQUIRE_SIGNATURE = 'signature';
- const VALUE_NONE = 'none';
- const VALUE_EMAIL = 'email';
- const VALUE_USER = 'user';
- const VALUE_RULE = 'rule';
- const VALUE_REPOSITORY = 'repository';
- const VALUE_OWNERS_PACKAGE = 'package';
- const VALUE_PROJECT = 'project';
- const VALUE_USER_OR_PROJECT = 'userorproject';
- const VALUE_BUILD_PLAN = 'buildplan';
- const VALUE_TASK_PRIORITY = 'taskpriority';
- const VALUE_TASK_STATUS = 'taskstatus';
- const VALUE_LEGAL_DOCUMENTS = 'legaldocuments';
- const VALUE_APPLICATION_EMAIL = 'applicationemail';
- const VALUE_SPACE = 'space';
-
private $contentSource;
private $isNewObject;
private $applicationEmail;
@@ -761,36 +746,43 @@
case self::ACTION_ASSIGN_TASK:
case self::ACTION_ADD_REVIEWERS:
case self::ACTION_ADD_BLOCKING_REVIEWERS:
- return self::VALUE_NONE;
+ return new HeraldEmptyFieldValue();
case self::ACTION_FLAG:
return $this->buildFlagColorFieldValue();
case self::ACTION_ADD_PROJECTS:
case self::ACTION_REMOVE_PROJECTS:
- return self::VALUE_PROJECT;
+ return $this->buildTokenizerFieldValue(
+ new PhabricatorProjectDatasource());
}
} else {
switch ($action) {
case self::ACTION_ADD_CC:
case self::ACTION_REMOVE_CC:
case self::ACTION_EMAIL:
- return self::VALUE_EMAIL;
+ return $this->buildTokenizerFieldValue(
+ new PhabricatorMetaMTAMailableDatasource());
case self::ACTION_NOTHING:
- return self::VALUE_NONE;
+ return new HeraldEmptyFieldValue();
case self::ACTION_ADD_PROJECTS:
case self::ACTION_REMOVE_PROJECTS:
- return self::VALUE_PROJECT;
+ return $this->buildTokenizerFieldValue(
+ new PhabricatorProjectDatasource());
case self::ACTION_FLAG:
return $this->buildFlagColorFieldValue();
case self::ACTION_ASSIGN_TASK:
- return self::VALUE_USER;
+ return $this->buildTokenizerFieldValue(
+ new PhabricatorPeopleDatasource());
case self::ACTION_AUDIT:
case self::ACTION_ADD_REVIEWERS:
case self::ACTION_ADD_BLOCKING_REVIEWERS:
- return self::VALUE_USER_OR_PROJECT;
+ return $this->buildTokenizerFieldValue(
+ new PhabricatorProjectOrUserDatasource());
case self::ACTION_APPLY_BUILD_PLANS:
- return self::VALUE_BUILD_PLAN;
+ return $this->buildTokenizerFieldValue(
+ new HarbormasterBuildPlanDatasource());
case self::ACTION_REQUIRE_SIGNATURE:
- return self::VALUE_LEGAL_DOCUMENTS;
+ return $this->buildTokenizerFieldValue(
+ new LegalpadDocumentDatasource());
case self::ACTION_BLOCK:
return new HeraldTextFieldValue();
}
@@ -811,6 +803,16 @@
->setDefault(PhabricatorFlagColor::COLOR_BLUE);
}
+ private function buildTokenizerFieldValue(
+ PhabricatorTypeaheadDatasource $datasource) {
+
+ $key = 'action.'.get_class($datasource);
+
+ return id(new HeraldTokenizerFieldValue())
+ ->setKey($key)
+ ->setDatasource($datasource);
+ }
+
/* -( Repetition )--------------------------------------------------------- */
diff --git a/src/applications/herald/controller/HeraldRuleController.php b/src/applications/herald/controller/HeraldRuleController.php
--- a/src/applications/herald/controller/HeraldRuleController.php
+++ b/src/applications/herald/controller/HeraldRuleController.php
@@ -458,6 +458,8 @@
$condition);
if ($value_key instanceof HeraldFieldValue) {
+ $value_key->setViewer($this->getViewer());
+
$spec = $value_key->getControlSpecificationDictionary();
$value_key = $value_key->getFieldValueKey();
$config_info['valueMap'][$value_key] = $spec;
@@ -479,6 +481,8 @@
}
if ($value_key instanceof HeraldFieldValue) {
+ $value_key->setViewer($this->getViewer());
+
$spec = $value_key->getControlSpecificationDictionary();
$value_key = $value_key->getFieldValueKey();
$config_info['valueMap'][$value_key] = $spec;
@@ -493,7 +497,7 @@
'root' => 'herald-rule-edit-form',
'conditions' => (object)$serial_conditions,
'actions' => (object)$serial_actions,
- 'template' => $this->buildTokenizerTemplates($handles) + array(
+ 'template' => $this->buildTokenizerTemplates() + array(
'rules' => $all_rules,
),
'info' => $config_info,
@@ -576,39 +580,10 @@
}
- protected function buildTokenizerTemplates(array $handles) {
+ protected function buildTokenizerTemplates() {
$template = new AphrontTokenizerTemplateView();
$template = $template->render();
-
- $sources = array(
- 'repository' => new DiffusionRepositoryDatasource(),
- 'legaldocuments' => new LegalpadDocumentDatasource(),
- 'taskpriority' => new ManiphestTaskPriorityDatasource(),
- 'taskstatus' => new ManiphestTaskStatusDatasource(),
- 'buildplan' => new HarbormasterBuildPlanDatasource(),
- 'package' => new PhabricatorOwnersPackageDatasource(),
- 'project' => new PhabricatorProjectDatasource(),
- 'user' => new PhabricatorPeopleDatasource(),
- 'email' => new PhabricatorMetaMTAMailableDatasource(),
- 'userorproject' => new PhabricatorProjectOrUserDatasource(),
- 'applicationemail' => new PhabricatorMetaMTAApplicationEmailDatasource(),
- 'space' => new PhabricatorSpacesNamespaceDatasource(),
- );
-
- foreach ($sources as $key => $source) {
- $source->setViewer($this->getViewer());
-
- $sources[$key] = array(
- 'uri' => $source->getDatasourceURI(),
- 'placeholder' => $source->getPlaceholderText(),
- 'browseURI' => $source->getBrowseURI(),
- );
- }
-
return array(
- 'source' => $sources,
- 'username' => $this->getRequest()->getUser()->getUserName(),
- 'icons' => mpull($handles, 'getTypeIcon', 'getPHID'),
'markup' => $template,
);
}
diff --git a/src/applications/herald/field/HeraldAlwaysField.php b/src/applications/herald/field/HeraldAlwaysField.php
--- a/src/applications/herald/field/HeraldAlwaysField.php
+++ b/src/applications/herald/field/HeraldAlwaysField.php
@@ -19,7 +19,7 @@
}
public function getHeraldFieldValueType($condition) {
- return HeraldAdapter::VALUE_NONE;
+ return new HeraldEmptyFieldValue();
}
public function supportsObject($object) {
diff --git a/src/applications/herald/field/HeraldAnotherRuleField.php b/src/applications/herald/field/HeraldAnotherRuleField.php
--- a/src/applications/herald/field/HeraldAnotherRuleField.php
+++ b/src/applications/herald/field/HeraldAnotherRuleField.php
@@ -24,8 +24,11 @@
}
public function getHeraldFieldValueType($condition) {
- return HeraldAdapter::VALUE_RULE;
+ // NOTE: This is a bit magical because we don't currently have a reasonable
+ // way to populate it from here.
+ return id(new HeraldSelectFieldValue())
+ ->setKey(self::FIELDCONST)
+ ->setOptions(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
@@ -20,6 +20,10 @@
throw new PhutilMethodNotImplementedException();
}
+ protected function getDatasource() {
+ throw new PhutilMethodNotImplementedException();
+ }
+
public function getHeraldFieldConditions() {
$standard_type = $this->getHeraldFieldStandardType();
switch ($standard_type) {
@@ -91,6 +95,20 @@
case self::STANDARD_TEXT_LIST:
case self::STANDARD_TEXT_MAP:
return new HeraldTextFieldValue();
+ case self::STANDARD_PHID:
+ case self::STANDARD_PHID_NULLABLE:
+ case self::STANDARD_PHID_LIST:
+ switch ($condition) {
+ case HeraldAdapter::CONDITION_EXISTS:
+ case HeraldAdapter::CONDITION_NOT_EXISTS:
+ return new HeraldEmptyFieldValue();
+ default:
+ return id(new HeraldTokenizerFieldValue())
+ ->setKey($this->getHeraldFieldName())
+ ->setDatasource($this->getDatasource());
+ }
+ break;
+
}
throw new Exception(
@@ -113,7 +131,8 @@
$value_type = $this->getHeraldFieldValueType($condition);
if ($value_type instanceof HeraldFieldValue) {
- return $value_type->renderValue($viewer, $value);
+ $value_type->setViewer($viewer);
+ return $value_type->renderFieldValue($value);
}
// TODO: While this is less of a mess than it used to be, it would still
diff --git a/src/applications/herald/value/HeraldEmptyFieldValue.php b/src/applications/herald/value/HeraldEmptyFieldValue.php
--- a/src/applications/herald/value/HeraldEmptyFieldValue.php
+++ b/src/applications/herald/value/HeraldEmptyFieldValue.php
@@ -11,7 +11,7 @@
return self::CONTROL_NONE;
}
- public function renderValue(PhabricatorUser $viewer, $value) {
+ public function renderFieldValue($value) {
return null;
}
diff --git a/src/applications/herald/value/HeraldFieldValue.php b/src/applications/herald/value/HeraldFieldValue.php
--- a/src/applications/herald/value/HeraldFieldValue.php
+++ b/src/applications/herald/value/HeraldFieldValue.php
@@ -2,6 +2,8 @@
abstract class HeraldFieldValue extends Phobject {
+ private $viewer;
+
const CONTROL_NONE = 'herald.control.none';
const CONTROL_TEXT = 'herald.control.text';
const CONTROL_SELECT = 'herald.control.select';
@@ -9,10 +11,20 @@
abstract public function getFieldValueKey();
abstract public function getControlType();
- abstract public function renderValue(PhabricatorUser $viewer, $value);
+ abstract public function renderFieldValue($value);
+
+ public function setViewer(PhabricatorUser $viewer) {
+ $this->viewer = $viewer;
+ return $this;
+ }
+
+ public function getViewer() {
+ return $this->viewer;
+ }
final public function getControlSpecificationDictionary() {
return array(
+ 'key' => $this->getFieldValueKey(),
'control' => $this->getControlType(),
'template' => $this->getControlTemplate(),
);
diff --git a/src/applications/herald/value/HeraldSelectFieldValue.php b/src/applications/herald/value/HeraldSelectFieldValue.php
--- a/src/applications/herald/value/HeraldSelectFieldValue.php
+++ b/src/applications/herald/value/HeraldSelectFieldValue.php
@@ -56,7 +56,7 @@
);
}
- public function renderValue(PhabricatorUser $viewer, $value) {
+ public function renderFieldValue($value) {
$options = $this->getOptions();
return idx($options, $value, $value);
}
diff --git a/src/applications/herald/value/HeraldTextFieldValue.php b/src/applications/herald/value/HeraldTextFieldValue.php
--- a/src/applications/herald/value/HeraldTextFieldValue.php
+++ b/src/applications/herald/value/HeraldTextFieldValue.php
@@ -12,7 +12,7 @@
}
- public function renderValue(PhabricatorUser $viewer, $value) {
+ public function renderFieldValue($value) {
return $value;
}
diff --git a/src/applications/herald/value/HeraldTokenizerFieldValue.php b/src/applications/herald/value/HeraldTokenizerFieldValue.php
new file mode 100644
--- /dev/null
+++ b/src/applications/herald/value/HeraldTokenizerFieldValue.php
@@ -0,0 +1,60 @@
+<?php
+
+final class HeraldTokenizerFieldValue
+ extends HeraldFieldValue {
+
+ private $key;
+ private $datasource;
+
+ public function setKey($key) {
+ $this->key = $key;
+ return $this;
+ }
+
+ public function getKey() {
+ return $this->key;
+ }
+
+ public function setDatasource(PhabricatorTypeaheadDatasource $datasource) {
+ $this->datasource = $datasource;
+ return $this;
+ }
+
+ public function getDatasource() {
+ return $this->datasource;
+ }
+
+ public function getFieldValueKey() {
+ if ($this->getKey() === null) {
+ throw new PhutilInvalidStateException('setKey');
+ }
+ return 'tokenizer.'.$this->getKey();
+ }
+
+ public function getControlType() {
+ return self::CONTROL_TOKENIZER;
+ }
+
+ protected function getControlTemplate() {
+ if ($this->getDatasource() === null) {
+ throw new PhutilInvalidStateException('setDatasource');
+ }
+
+ $datasource = $this->getDatasource();
+ $datasource->setViewer($this->getViewer());
+
+ return array(
+ 'tokenizer' => array(
+ 'datasourceURI' => $datasource->getDatasourceURI(),
+ 'browseURI' => $datasource->getBrowseURI(),
+ 'placeholder' => $datasource->getPlaceholderText(),
+ ),
+ );
+ }
+
+ public function renderFieldValue($value) {
+ $viewer = $this->getViewer();
+ return $viewer->renderHandleList((array)$value)->setAsInline(true);
+ }
+
+}
diff --git a/src/applications/maniphest/herald/ManiphestTaskAssigneeHeraldField.php b/src/applications/maniphest/herald/ManiphestTaskAssigneeHeraldField.php
--- a/src/applications/maniphest/herald/ManiphestTaskAssigneeHeraldField.php
+++ b/src/applications/maniphest/herald/ManiphestTaskAssigneeHeraldField.php
@@ -17,14 +17,8 @@
return self::STANDARD_PHID_NULLABLE;
}
- public function getHeraldFieldValueType($condition) {
- switch ($condition) {
- case HeraldAdapter::CONDITION_EXISTS:
- case HeraldAdapter::CONDITION_NOT_EXISTS:
- return HeraldAdapter::VALUE_NONE;
- default:
- return HeraldAdapter::VALUE_USER;
- }
+ protected function getDatasource() {
+ return new PhabricatorPeopleDatasource();
}
}
diff --git a/src/applications/maniphest/herald/ManiphestTaskAuthorHeraldField.php b/src/applications/maniphest/herald/ManiphestTaskAuthorHeraldField.php
--- a/src/applications/maniphest/herald/ManiphestTaskAuthorHeraldField.php
+++ b/src/applications/maniphest/herald/ManiphestTaskAuthorHeraldField.php
@@ -17,8 +17,8 @@
return self::STANDARD_PHID;
}
- public function getHeraldFieldValueType($condition) {
- return HeraldAdapter::VALUE_USER;
+ protected function getDatasource() {
+ return new PhabricatorPeopleDatasource();
}
}
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
@@ -17,8 +17,8 @@
return self::STANDARD_PHID;
}
- public function getHeraldFieldValueType($condition) {
- return HeraldAdapter::VALUE_TASK_PRIORITY;
+ protected function getDatasource() {
+ return new ManiphestTaskPriorityDatasource();
}
public function renderConditionValue(
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
@@ -17,8 +17,8 @@
return self::STANDARD_PHID;
}
- public function getHeraldFieldValueType($condition) {
- return HeraldAdapter::VALUE_TASK_STATUS;
+ protected function getDatasource() {
+ return new ManiphestTaskStatusDatasource();
}
public function renderConditionValue(
diff --git a/src/applications/metamta/herald/PhabricatorMetaMTAApplicationEmailHeraldField.php b/src/applications/metamta/herald/PhabricatorMetaMTAApplicationEmailHeraldField.php
--- a/src/applications/metamta/herald/PhabricatorMetaMTAApplicationEmailHeraldField.php
+++ b/src/applications/metamta/herald/PhabricatorMetaMTAApplicationEmailHeraldField.php
@@ -28,14 +28,8 @@
return self::STANDARD_PHID_LIST;
}
- public function getHeraldFieldValueType($condition) {
- switch ($condition) {
- case HeraldAdapter::CONDITION_EXISTS:
- case HeraldAdapter::CONDITION_NOT_EXISTS:
- return HeraldAdapter::VALUE_NONE;
- default:
- return HeraldAdapter::VALUE_APPLICATION_EMAIL;
- }
+ protected function getDatasource() {
+ return new PhabricatorMetaMTAApplicationEmailDatasource();
}
}
diff --git a/src/applications/pholio/herald/PholioMockAuthorHeraldField.php b/src/applications/pholio/herald/PholioMockAuthorHeraldField.php
--- a/src/applications/pholio/herald/PholioMockAuthorHeraldField.php
+++ b/src/applications/pholio/herald/PholioMockAuthorHeraldField.php
@@ -17,8 +17,8 @@
return self::STANDARD_PHID;
}
- public function getHeraldFieldValueType($condition) {
- return HeraldAdapter::VALUE_USER;
+ protected function getDatasource() {
+ return new PhabricatorPeopleDatasource();
}
}
diff --git a/src/applications/phriction/herald/PhrictionDocumentAuthorHeraldField.php b/src/applications/phriction/herald/PhrictionDocumentAuthorHeraldField.php
--- a/src/applications/phriction/herald/PhrictionDocumentAuthorHeraldField.php
+++ b/src/applications/phriction/herald/PhrictionDocumentAuthorHeraldField.php
@@ -17,8 +17,8 @@
return self::STANDARD_PHID;
}
- public function getHeraldFieldValueType($condition) {
- return HeraldAdapter::VALUE_USER;
+ protected function getDatasource() {
+ return new PhabricatorPeopleDatasource();
}
}
diff --git a/src/applications/project/herald/HeraldProjectsField.php b/src/applications/project/herald/HeraldProjectsField.php
--- a/src/applications/project/herald/HeraldProjectsField.php
+++ b/src/applications/project/herald/HeraldProjectsField.php
@@ -22,14 +22,8 @@
return self::STANDARD_PHID_LIST;
}
- public function getHeraldFieldValueType($condition) {
- switch ($condition) {
- case HeraldAdapter::CONDITION_EXISTS:
- case HeraldAdapter::CONDITION_NOT_EXISTS:
- return HeraldAdapter::VALUE_NONE;
- default:
- return HeraldAdapter::VALUE_PROJECT;
- }
+ protected function getDatasource() {
+ return new PhabricatorProjectDatasource();
}
}
diff --git a/src/applications/spaces/herald/HeraldSpaceField.php b/src/applications/spaces/herald/HeraldSpaceField.php
--- a/src/applications/spaces/herald/HeraldSpaceField.php
+++ b/src/applications/spaces/herald/HeraldSpaceField.php
@@ -20,8 +20,8 @@
return self::STANDARD_PHID;
}
- public function getHeraldFieldValueType($condition) {
- return HeraldAdapter::VALUE_SPACE;
+ protected function getDatasource() {
+ return new PhabricatorSpacesNamespaceDatasource();
}
}
diff --git a/src/applications/subscriptions/herald/HeraldSubscribersField.php b/src/applications/subscriptions/herald/HeraldSubscribersField.php
--- a/src/applications/subscriptions/herald/HeraldSubscribersField.php
+++ b/src/applications/subscriptions/herald/HeraldSubscribersField.php
@@ -21,14 +21,8 @@
return self::STANDARD_PHID_LIST;
}
- public function getHeraldFieldValueType($condition) {
- switch ($condition) {
- case HeraldAdapter::CONDITION_EXISTS:
- case HeraldAdapter::CONDITION_NOT_EXISTS:
- return HeraldAdapter::VALUE_NONE;
- default:
- return HeraldAdapter::VALUE_USER_OR_PROJECT;
- }
+ protected function getDatasource() {
+ return new PhabricatorProjectOrUserDatasource();
}
}
diff --git a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldUsers.php b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldUsers.php
--- a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldUsers.php
+++ b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldUsers.php
@@ -41,7 +41,9 @@
}
public function getHeraldFieldValueType($condition) {
- return HeraldAdapter::VALUE_USER;
+ return id(new HeraldTokenizerFieldValue())
+ ->setKey('custom.'.$this->getFieldKey())
+ ->setDatasource(new PhabricatorPeopleDatasource());
}
}
diff --git a/webroot/rsrc/js/application/herald/HeraldRuleEditor.js b/webroot/rsrc/js/application/herald/HeraldRuleEditor.js
--- a/webroot/rsrc/js/application/herald/HeraldRuleEditor.js
+++ b/webroot/rsrc/js/application/herald/HeraldRuleEditor.js
@@ -200,7 +200,9 @@
return node;
},
- _buildStandardInput: function(spec) {
+ _buildInput : function(type) {
+ var spec = this._config.info.valueMap[type];
+
var input;
var get_fn;
var set_fn;
@@ -216,7 +218,18 @@
set_fn = function(v) { input.value = v; };
break;
case 'herald.control.select':
- input = this._renderSelect(spec.template.options);
+ var options;
+
+ // NOTE: This is a hacky special case for "Another Herald Rule",
+ // which we don't currently generate normal options for.
+
+ if (spec.key == 'select.rule') {
+ options = this._config.template.rules;
+ } else {
+ options = spec.template.options;
+ }
+
+ input = this._renderSelect(options);
get_fn = function() { return input.value; };
set_fn = function(v) { input.value = v; };
if (spec.template.default) {
@@ -224,7 +237,7 @@
}
break;
case 'herald.control.tokenizer':
- var tokenizer = this._newTokenizer(spec.template.tokenizer, true);
+ var tokenizer = this._newTokenizer(spec.template.tokenizer);
input = tokenizer[0];
get_fn = tokenizer[1];
set_fn = tokenizer[2];
@@ -237,48 +250,6 @@
return [input, get_fn, set_fn];
},
- _buildInput : function(type) {
- if (this._config.info.valueMap[type]) {
- return this._buildStandardInput(this._config.info.valueMap[type]);
- }
-
- var input;
- var get_fn;
- var set_fn;
- switch (type) {
- case 'rule':
- input = this._renderSelect(this._config.template.rules);
- get_fn = function() { return input.value; };
- set_fn = function(v) { input.value = v; };
- break;
- case 'email':
- case 'user':
- case 'repository':
- case 'tag':
- case 'package':
- case 'project':
- case 'userorproject':
- case 'buildplan':
- case 'taskpriority':
- case 'taskstatus':
- case 'legaldocuments':
- case 'applicationemail':
- case 'space':
- var tokenizer = this._newTokenizer(type);
- input = tokenizer[0];
- get_fn = tokenizer[1];
- set_fn = tokenizer[2];
- break;
- default:
- input = JX.$N('input', {type: 'text'});
- get_fn = function() { return input.value; };
- set_fn = function(v) { input.value = v; };
- break;
- }
-
- return [input, get_fn, set_fn];
- },
-
_renderValueInputForRow : function(row_id) {
var cond = this._config.conditions[row_id];
var type = this._config.info.values[cond[0]][cond[1]];
@@ -303,20 +274,12 @@
return node;
},
- _newTokenizer : function(type, is_config) {
- var tokenizerConfig;
-
- if (is_config) {
- tokenizerConfig = type;
- } else {
- tokenizerConfig = {
- src : this._config.template.source[type].uri,
- placeholder: this._config.template.source[type].placeholder,
- browseURI: this._config.template.source[type].browseURI,
- icons : this._config.template.icons,
- username : this._config.username
- };
- }
+ _newTokenizer : function(spec) {
+ var tokenizerConfig = {
+ src: spec.datasourceURI,
+ placeholder: spec.placeholder,
+ browseURI: spec.browseURI
+ };
var build = JX.Prefab.newTokenizerFromTemplate(
this._config.template.markup,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Jun 8, 7:01 AM (1 w, 3 d ago)
Storage Engine
amazon-s3
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
phabricator/secure/yk/it/jke26ejgy6iiqyne
Default Alt Text
D13616.diff (52 KB)
Attached To
Mode
D13616: Fully modularize Herald field values
Attached
Detach File
Event Timeline
Log In to Comment