Page MenuHomePhabricator

D9887.id23743.diff
No OneTemporary

D9887.id23743.diff

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
@@ -2001,6 +2001,7 @@
'PhabricatorProjectMembersRemoveController' => 'applications/project/controller/PhabricatorProjectMembersRemoveController.php',
'PhabricatorProjectMoveController' => 'applications/project/controller/PhabricatorProjectMoveController.php',
'PhabricatorProjectNameCollisionException' => 'applications/project/exception/PhabricatorProjectNameCollisionException.php',
+ 'PhabricatorProjectOrUserDatasource' => 'applications/project/typeahead/PhabricatorProjectOrUserDatasource.php',
'PhabricatorProjectPHIDTypeColumn' => 'applications/project/phid/PhabricatorProjectPHIDTypeColumn.php',
'PhabricatorProjectPHIDTypeProject' => 'applications/project/phid/PhabricatorProjectPHIDTypeProject.php',
'PhabricatorProjectProfileController' => 'applications/project/controller/PhabricatorProjectProfileController.php',
@@ -4877,6 +4878,7 @@
'PhabricatorProjectMembersRemoveController' => 'PhabricatorProjectController',
'PhabricatorProjectMoveController' => 'PhabricatorProjectController',
'PhabricatorProjectNameCollisionException' => 'Exception',
+ 'PhabricatorProjectOrUserDatasource' => 'PhabricatorTypeaheadCompositeDatasource',
'PhabricatorProjectPHIDTypeColumn' => 'PhabricatorPHIDType',
'PhabricatorProjectPHIDTypeProject' => 'PhabricatorPHIDType',
'PhabricatorProjectProfileController' => 'PhabricatorProjectController',
diff --git a/src/applications/differential/customfield/DifferentialReviewersField.php b/src/applications/differential/customfield/DifferentialReviewersField.php
--- a/src/applications/differential/customfield/DifferentialReviewersField.php
+++ b/src/applications/differential/customfield/DifferentialReviewersField.php
@@ -69,7 +69,7 @@
public function renderEditControl(array $handles) {
return id(new AphrontFormTokenizerControl())
->setName($this->getFieldKey())
- ->setDatasource('/typeahead/common/usersorprojects/')
+ ->setDatasource(new PhabricatorProjectOrUserDatasource())
->setValue($handles)
->setError($this->getFieldError())
->setLabel($this->getFieldName());
diff --git a/src/applications/differential/query/DifferentialRevisionSearchEngine.php b/src/applications/differential/query/DifferentialRevisionSearchEngine.php
--- a/src/applications/differential/query/DifferentialRevisionSearchEngine.php
+++ b/src/applications/differential/query/DifferentialRevisionSearchEngine.php
@@ -155,7 +155,7 @@
id(new AphrontFormTokenizerControl())
->setLabel(pht('Reviewers'))
->setName('reviewers')
- ->setDatasource('/typeahead/common/accountsorprojects/')
+ ->setDatasource(new PhabricatorProjectOrUserDatasource())
->setValue(array_select_keys($handles, $reviewer_phids)))
->appendChild(
id(new AphrontFormTokenizerControl())
diff --git a/src/applications/differential/view/DifferentialAddCommentView.php b/src/applications/differential/view/DifferentialAddCommentView.php
--- a/src/applications/differential/view/DifferentialAddCommentView.php
+++ b/src/applications/differential/view/DifferentialAddCommentView.php
@@ -109,6 +109,7 @@
->setValue(pht('Submit')));
$mailable_source = new PhabricatorMetaMTAMailableDatasource();
+ $reviewer_source = new PhabricatorProjectOrUserDatasource();
Javelin::initBehavior(
'differential-add-reviewers-and-ccs',
@@ -120,11 +121,11 @@
'add_reviewers' => 1,
'resign' => 1,
),
- 'src' => '/typeahead/common/usersorprojects/',
+ 'src' => $reviewer_source->getDatasourceURI(),
'value' => $this->reviewers,
'row' => 'add-reviewers',
'labels' => $add_reviewers_labels,
- 'placeholder' => pht('Type a user or project name...'),
+ 'placeholder' => $reviewer_source->getPlaceholderText(),
),
'add-ccs-tokenizer' => array(
'actions' => array('add_ccs' => 1),
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
@@ -598,12 +598,10 @@
'project' => new PhabricatorProjectDatasource(),
'user' => new PhabricatorPeopleDatasource(),
'email' => new PhabricatorMetaMTAMailableDatasource(),
+ 'userorproject' => new PhabricatorProjectOrUserDatasource(),
);
$sources = mpull($sources, 'getDatasourceURI');
- $sources += array(
- 'userorproject' => '/typeahead/common/accountsorprojects/',
- );
return array(
'source' => $sources,
diff --git a/src/applications/owners/controller/PhabricatorOwnersEditController.php b/src/applications/owners/controller/PhabricatorOwnersEditController.php
--- a/src/applications/owners/controller/PhabricatorOwnersEditController.php
+++ b/src/applications/owners/controller/PhabricatorOwnersEditController.php
@@ -181,7 +181,7 @@
->setError($e_name))
->appendChild(
id(new AphrontFormTokenizerControl())
- ->setDatasource('/typeahead/common/usersorprojects/')
+ ->setDatasource(new PhabricatorProjectOrUserDatasource())
->setLabel(pht('Primary Owner'))
->setName('primary')
->setLimit(1)
@@ -189,7 +189,7 @@
->setError($e_primary))
->appendChild(
id(new AphrontFormTokenizerControl())
- ->setDatasource('/typeahead/common/usersorprojects/')
+ ->setDatasource(new PhabricatorProjectOrUserDatasource())
->setLabel(pht('Owners'))
->setName('owners')
->setValue($handles_all_owners))
diff --git a/src/applications/owners/controller/PhabricatorOwnersListController.php b/src/applications/owners/controller/PhabricatorOwnersListController.php
--- a/src/applications/owners/controller/PhabricatorOwnersListController.php
+++ b/src/applications/owners/controller/PhabricatorOwnersListController.php
@@ -177,7 +177,7 @@
->setValue($request->getStr('name')))
->appendChild(
id(new AphrontFormTokenizerControl())
- ->setDatasource('/typeahead/common/usersorprojects/')
+ ->setDatasource(new PhabricatorProjectOrUserDatasource())
->setLimit(1)
->setName('owner')
->setLabel(pht('Owner'))
diff --git a/src/applications/project/typeahead/PhabricatorProjectOrUserDatasource.php b/src/applications/project/typeahead/PhabricatorProjectOrUserDatasource.php
new file mode 100644
--- /dev/null
+++ b/src/applications/project/typeahead/PhabricatorProjectOrUserDatasource.php
@@ -0,0 +1,17 @@
+<?php
+
+final class PhabricatorProjectOrUserDatasource
+ extends PhabricatorTypeaheadCompositeDatasource {
+
+ public function getPlaceholderText() {
+ return pht('Type a user or project name...');
+ }
+
+ public function getComponentDatasources() {
+ return array(
+ new PhabricatorPeopleDatasource(),
+ new PhabricatorProjectDatasource(),
+ );
+ }
+
+}
diff --git a/src/applications/typeahead/controller/PhabricatorTypeaheadCommonDatasourceController.php b/src/applications/typeahead/controller/PhabricatorTypeaheadCommonDatasourceController.php
--- a/src/applications/typeahead/controller/PhabricatorTypeaheadCommonDatasourceController.php
+++ b/src/applications/typeahead/controller/PhabricatorTypeaheadCommonDatasourceController.php
@@ -47,11 +47,6 @@
$need_projs = true;
$need_noproject = true;
break;
- case 'usersorprojects':
- case 'accountsorprojects':
- $need_users = true;
- $need_projs = true;
- break;
case 'usersprojectsorpackages':
$need_users = true;
$need_projs = true;
diff --git a/src/view/form/control/AphrontFormTokenizerControl.php b/src/view/form/control/AphrontFormTokenizerControl.php
--- a/src/view/form/control/AphrontFormTokenizerControl.php
+++ b/src/view/form/control/AphrontFormTokenizerControl.php
@@ -95,10 +95,8 @@
$request = $matches[1];
$map = array(
- 'usersorprojects' => pht('Type a user or project name...'),
'searchowner' => pht('Type a user name...'),
'searchproject' => pht('Type a project name...'),
- 'accountsorprojects' => pht('Type a user or project name...'),
'usersprojectsorpackages' =>
pht('Type a user, project, or package name...'),
);

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 29, 2:51 PM (18 h, 50 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6805763
Default Alt Text
D9887.id23743.diff (8 KB)

Event Timeline