Page MenuHomePhabricator

D9884.diff
No OneTemporary

D9884.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
@@ -1984,6 +1984,7 @@
'PhabricatorProjectCustomFieldStorage' => 'applications/project/storage/PhabricatorProjectCustomFieldStorage.php',
'PhabricatorProjectCustomFieldStringIndex' => 'applications/project/storage/PhabricatorProjectCustomFieldStringIndex.php',
'PhabricatorProjectDAO' => 'applications/project/storage/PhabricatorProjectDAO.php',
+ 'PhabricatorProjectDatasource' => 'applications/project/typeahead/PhabricatorProjectDatasource.php',
'PhabricatorProjectDescriptionField' => 'applications/project/customfield/PhabricatorProjectDescriptionField.php',
'PhabricatorProjectEditDetailsController' => 'applications/project/controller/PhabricatorProjectEditDetailsController.php',
'PhabricatorProjectEditIconController' => 'applications/project/controller/PhabricatorProjectEditIconController.php',
@@ -4857,6 +4858,7 @@
'PhabricatorProjectCustomFieldStorage' => 'PhabricatorCustomFieldStorage',
'PhabricatorProjectCustomFieldStringIndex' => 'PhabricatorCustomFieldStringIndexStorage',
'PhabricatorProjectDAO' => 'PhabricatorLiskDAO',
+ 'PhabricatorProjectDatasource' => 'PhabricatorTypeaheadDatasource',
'PhabricatorProjectDescriptionField' => 'PhabricatorProjectStandardCustomField',
'PhabricatorProjectEditDetailsController' => 'PhabricatorProjectController',
'PhabricatorProjectEditIconController' => 'PhabricatorProjectController',
diff --git a/src/applications/differential/customfield/DifferentialProjectsField.php b/src/applications/differential/customfield/DifferentialProjectsField.php
--- a/src/applications/differential/customfield/DifferentialProjectsField.php
+++ b/src/applications/differential/customfield/DifferentialProjectsField.php
@@ -56,7 +56,7 @@
public function renderEditControl(array $handles) {
return id(new AphrontFormTokenizerControl())
->setName($this->getFieldKey())
- ->setDatasource('/typeahead/common/projects/')
+ ->setDatasource(new PhabricatorProjectDatasource())
->setValue($handles)
->setLabel($this->getFieldName());
}
diff --git a/src/applications/diffusion/controller/DiffusionCommitEditController.php b/src/applications/diffusion/controller/DiffusionCommitEditController.php
--- a/src/applications/diffusion/controller/DiffusionCommitEditController.php
+++ b/src/applications/diffusion/controller/DiffusionCommitEditController.php
@@ -70,7 +70,7 @@
'sigil' => 'project-create',
),
pht('Create New Project')))
- ->setDatasource('/typeahead/common/projects/'));;
+ ->setDatasource(new PhabricatorProjectDatasource()));
Javelin::initBehavior('project-create', array(
'tokenizerID' => $tokenizer_id,
diff --git a/src/applications/diffusion/controller/DiffusionRepositoryEditBasicController.php b/src/applications/diffusion/controller/DiffusionRepositoryEditBasicController.php
--- a/src/applications/diffusion/controller/DiffusionRepositoryEditBasicController.php
+++ b/src/applications/diffusion/controller/DiffusionRepositoryEditBasicController.php
@@ -125,7 +125,7 @@
->setValue($v_desc))
->appendChild(
id(new AphrontFormTokenizerControl())
- ->setDatasource('/typeahead/common/projects/')
+ ->setDatasource(new PhabricatorProjectDatasource())
->setName('projectPHIDs')
->setLabel(pht('Projects'))
->setValue($project_handles))
diff --git a/src/applications/feed/query/PhabricatorFeedSearchEngine.php b/src/applications/feed/query/PhabricatorFeedSearchEngine.php
--- a/src/applications/feed/query/PhabricatorFeedSearchEngine.php
+++ b/src/applications/feed/query/PhabricatorFeedSearchEngine.php
@@ -84,7 +84,7 @@
->setValue($user_handles))
->appendChild(
id(new AphrontFormTokenizerControl())
- ->setDatasource('/typeahead/common/projects/')
+ ->setDatasource(new PhabricatorProjectDatasource())
->setName('projectPHIDs')
->setLabel(pht('Include Projects'))
->setValue($proj_handles))
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
@@ -595,13 +595,13 @@
'buildplan' => new HarbormasterBuildPlanDatasource(),
'arcanistprojects' => new DiffusionArcanistProjectDatasource(),
'package' => new PhabricatorOwnersPackageDatasource(),
+ 'project' => new PhabricatorProjectDatasource(),
);
$sources = mpull($sources, 'getDatasourceURI');
$sources += array(
'email' => '/typeahead/common/mailable/',
'user' => '/typeahead/common/accounts/',
- 'project' => '/typeahead/common/projects/',
'userorproject' => '/typeahead/common/accountsorprojects/',
);
diff --git a/src/applications/maniphest/controller/ManiphestBatchEditController.php b/src/applications/maniphest/controller/ManiphestBatchEditController.php
--- a/src/applications/maniphest/controller/ManiphestBatchEditController.php
+++ b/src/applications/maniphest/controller/ManiphestBatchEditController.php
@@ -61,6 +61,8 @@
$template = new AphrontTokenizerTemplateView();
$template = $template->render();
+ $projects_source = new PhabricatorProjectDatasource();
+
require_celerity_resource('maniphest-batch-editor');
Javelin::initBehavior(
'maniphest-batch-editor',
@@ -69,8 +71,8 @@
'tokenizerTemplate' => $template,
'sources' => array(
'project' => array(
- 'src' => '/typeahead/common/projects/',
- 'placeholder' => pht('Type a project name...'),
+ 'src' => $projects_source->getDatasourceURI(),
+ 'placeholder' => $projects_source->getPlaceholderText(),
),
'owner' => array(
'src' => '/typeahead/common/searchowner/',
diff --git a/src/applications/maniphest/controller/ManiphestTaskDetailController.php b/src/applications/maniphest/controller/ManiphestTaskDetailController.php
--- a/src/applications/maniphest/controller/ManiphestTaskDetailController.php
+++ b/src/applications/maniphest/controller/ManiphestTaskDetailController.php
@@ -282,11 +282,13 @@
ManiphestTransaction::TYPE_PROJECTS => 'projects',
);
+ $projects_source = new PhabricatorProjectDatasource();
+
$tokenizer_map = array(
ManiphestTransaction::TYPE_PROJECTS => array(
'id' => 'projects-tokenizer',
- 'src' => '/typeahead/common/projects/',
- 'placeholder' => pht('Type a project name...'),
+ 'src' => $projects_source->getDatasourceURI(),
+ 'placeholder' => $projects_source->getPlaceholderText(),
),
ManiphestTransaction::TYPE_OWNER => array(
'id' => 'assign-tokenizer',
diff --git a/src/applications/maniphest/controller/ManiphestTaskEditController.php b/src/applications/maniphest/controller/ManiphestTaskEditController.php
--- a/src/applications/maniphest/controller/ManiphestTaskEditController.php
+++ b/src/applications/maniphest/controller/ManiphestTaskEditController.php
@@ -650,7 +650,7 @@
'sigil' => 'project-create',
),
pht('Create New Project')))
- ->setDatasource('/typeahead/common/projects/'));
+ ->setDatasource(new PhabricatorProjectDatasource()));
}
$field_list->appendFieldsToForm($form);
diff --git a/src/applications/maniphest/query/ManiphestTaskSearchEngine.php b/src/applications/maniphest/query/ManiphestTaskSearchEngine.php
--- a/src/applications/maniphest/query/ManiphestTaskSearchEngine.php
+++ b/src/applications/maniphest/query/ManiphestTaskSearchEngine.php
@@ -322,7 +322,7 @@
$with_unassigned))
->appendChild(
id(new AphrontFormTokenizerControl())
- ->setDatasource('/typeahead/common/projects/')
+ ->setDatasource(new PhabricatorProjectDatasource())
->setName('allProjects')
->setLabel(pht('In All Projects'))
->setValue($all_project_handles));
@@ -341,13 +341,13 @@
$form
->appendChild(
id(new AphrontFormTokenizerControl())
- ->setDatasource('/typeahead/common/projects/')
+ ->setDatasource(new PhabricatorProjectDatasource())
->setName('anyProjects')
->setLabel(pht('In Any Project'))
->setValue($any_project_handles))
->appendChild(
id(new AphrontFormTokenizerControl())
- ->setDatasource('/typeahead/common/projects/')
+ ->setDatasource(new PhabricatorProjectDatasource())
->setName('excludeProjects')
->setLabel(pht('Not In Projects'))
->setValue($exclude_project_handles))
diff --git a/src/applications/paste/controller/PhabricatorPasteEditController.php b/src/applications/paste/controller/PhabricatorPasteEditController.php
--- a/src/applications/paste/controller/PhabricatorPasteEditController.php
+++ b/src/applications/paste/controller/PhabricatorPasteEditController.php
@@ -186,7 +186,7 @@
->setLabel(pht('Projects'))
->setName('projects')
->setValue($project_handles)
- ->setDatasource('/typeahead/common/projects/'));
+ ->setDatasource(new PhabricatorProjectDatasource()));
$form
->appendChild(
diff --git a/src/applications/pholio/controller/PholioMockEditController.php b/src/applications/pholio/controller/PholioMockEditController.php
--- a/src/applications/pholio/controller/PholioMockEditController.php
+++ b/src/applications/pholio/controller/PholioMockEditController.php
@@ -341,40 +341,41 @@
$form->addHiddenInput('status', 'open');
}
- $form->appendChild(
+ $form
+ ->appendChild(
id(new AphrontFormTokenizerControl())
->setLabel(pht('Projects'))
->setName('projects')
->setValue($project_handles)
- ->setDatasource('/typeahead/common/projects/'))
+ ->setDatasource(new PhabricatorProjectDatasource()))
->appendChild(
id(new AphrontFormTokenizerControl())
- ->setLabel(pht('CC'))
- ->setName('cc')
- ->setValue($handles)
- ->setUser($user)
- ->setDatasource('/typeahead/common/mailable/'))
+ ->setLabel(pht('CC'))
+ ->setName('cc')
+ ->setValue($handles)
+ ->setUser($user)
+ ->setDatasource('/typeahead/common/mailable/'))
->appendChild(
id(new AphrontFormPolicyControl())
- ->setUser($user)
- ->setCapability(PhabricatorPolicyCapability::CAN_VIEW)
- ->setPolicyObject($mock)
- ->setPolicies($policies)
- ->setName('can_view'))
+ ->setUser($user)
+ ->setCapability(PhabricatorPolicyCapability::CAN_VIEW)
+ ->setPolicyObject($mock)
+ ->setPolicies($policies)
+ ->setName('can_view'))
->appendChild(
id(new AphrontFormPolicyControl())
- ->setUser($user)
- ->setCapability(PhabricatorPolicyCapability::CAN_EDIT)
- ->setPolicyObject($mock)
- ->setPolicies($policies)
- ->setName('can_edit'))
+ ->setUser($user)
+ ->setCapability(PhabricatorPolicyCapability::CAN_EDIT)
+ ->setPolicyObject($mock)
+ ->setPolicies($policies)
+ ->setName('can_edit'))
->appendChild(
id(new AphrontFormMarkupControl())
- ->setValue($list_control))
+ ->setValue($list_control))
->appendChild(
id(new AphrontFormMarkupControl())
- ->setValue($drop_control)
- ->setError($e_images))
+ ->setValue($drop_control)
+ ->setError($e_images))
->appendChild($submit);
$form_box = id(new PHUIObjectBoxView())
diff --git a/src/applications/policy/rule/PhabricatorPolicyRuleProjects.php b/src/applications/policy/rule/PhabricatorPolicyRuleProjects.php
--- a/src/applications/policy/rule/PhabricatorPolicyRuleProjects.php
+++ b/src/applications/policy/rule/PhabricatorPolicyRuleProjects.php
@@ -39,10 +39,12 @@
}
public function getValueControlTemplate() {
+ $projects_source = new PhabricatorProjectDatasource();
+
return array(
'markup' => new AphrontTokenizerTemplateView(),
- 'uri' => '/typeahead/common/projects/',
- 'placeholder' => pht('Type a project name...'),
+ 'uri' => $projects_source->getDatasourceURI(),
+ 'placeholder' => $projects_source->getPlaceholderText(),
);
}
diff --git a/src/applications/ponder/controller/PonderQuestionEditController.php b/src/applications/ponder/controller/PonderQuestionEditController.php
--- a/src/applications/ponder/controller/PonderQuestionEditController.php
+++ b/src/applications/ponder/controller/PonderQuestionEditController.php
@@ -115,7 +115,7 @@
->setLabel(pht('Projects'))
->setName('projects')
->setValue($project_handles)
- ->setDatasource('/typeahead/common/projects/'));
+ ->setDatasource(new PhabricatorProjectDatasource()));
$form ->appendChild(
id(new AphrontFormSubmitControl())
diff --git a/src/applications/project/typeahead/PhabricatorProjectDatasource.php b/src/applications/project/typeahead/PhabricatorProjectDatasource.php
new file mode 100644
--- /dev/null
+++ b/src/applications/project/typeahead/PhabricatorProjectDatasource.php
@@ -0,0 +1,47 @@
+<?php
+
+final class PhabricatorProjectDatasource
+ extends PhabricatorTypeaheadDatasource {
+
+ public function getPlaceholderText() {
+ return pht('Type a project name...');
+ }
+
+ public function getDatasourceApplicationClass() {
+ return 'PhabricatorApplicationProject';
+ }
+
+ public function loadResults() {
+ $viewer = $this->getViewer();
+ $raw_query = $this->getRawQuery();
+
+ $results = array();
+
+ $projs = id(new PhabricatorProjectQuery())
+ ->setViewer($viewer)
+ ->needImages(true)
+ ->execute();
+ foreach ($projs as $proj) {
+ $closed = null;
+ if ($proj->isArchived()) {
+ $closed = pht('Archived');
+ }
+
+ $proj_result = id(new PhabricatorTypeaheadResult())
+ ->setName($proj->getName())
+ ->setDisplayType('Project')
+ ->setURI('/tag/'.$proj->getPrimarySlug().'/')
+ ->setPHID($proj->getPHID())
+ ->setIcon($proj->getIcon())
+ ->setPriorityType('proj')
+ ->setClosed($closed);
+
+ $proj_result->setImageURI($proj->getProfileImageURI());
+
+ $results[] = $proj_result;
+ }
+
+ return $results;
+ }
+
+}
diff --git a/src/applications/repository/query/PhabricatorRepositorySearchEngine.php b/src/applications/repository/query/PhabricatorRepositorySearchEngine.php
--- a/src/applications/repository/query/PhabricatorRepositorySearchEngine.php
+++ b/src/applications/repository/query/PhabricatorRepositorySearchEngine.php
@@ -106,7 +106,7 @@
->setValue($name))
->appendChild(
id(new AphrontFormTokenizerControl())
- ->setDatasource('/typeahead/common/projects/')
+ ->setDatasource(new PhabricatorProjectDatasource())
->setName('anyProjects')
->setLabel(pht('In Any Project'))
->setValue($any_project_handles))
diff --git a/src/applications/search/query/PhabricatorSearchApplicationSearchEngine.php b/src/applications/search/query/PhabricatorSearchApplicationSearchEngine.php
--- a/src/applications/search/query/PhabricatorSearchApplicationSearchEngine.php
+++ b/src/applications/search/query/PhabricatorSearchApplicationSearchEngine.php
@@ -161,7 +161,7 @@
id(new AphrontFormTokenizerControl())
->setName('projectPHIDs')
->setLabel('In Any Project')
- ->setDatasource('/typeahead/common/projects/')
+ ->setDatasource(new PhabricatorProjectDatasource())
->setValue($project_handles));
}
diff --git a/src/applications/slowvote/controller/PhabricatorSlowvoteEditController.php b/src/applications/slowvote/controller/PhabricatorSlowvoteEditController.php
--- a/src/applications/slowvote/controller/PhabricatorSlowvoteEditController.php
+++ b/src/applications/slowvote/controller/PhabricatorSlowvoteEditController.php
@@ -171,7 +171,7 @@
->setLabel(pht('Projects'))
->setName('projects')
->setValue($project_handles)
- ->setDatasource('/typeahead/common/projects/'));
+ ->setDatasource(new PhabricatorProjectDatasource()));
if ($is_new) {
for ($ii = 0; $ii < 10; $ii++) {
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
@@ -59,9 +59,6 @@
$need_lists = true;
$need_projs = true;
break;
- case 'projects':
- $need_projs = true;
- break;
case 'usersorprojects':
case 'accountsorprojects':
$need_users = true;

File Metadata

Mime Type
text/plain
Expires
Fri, Oct 25, 4:54 PM (3 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6720703
Default Alt Text
D9884.diff (17 KB)

Event Timeline