diff --git a/resources/celerity/map.php b/resources/celerity/map.php --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -414,7 +414,7 @@ 'rsrc/js/application/phortune/behavior-test-payment-form.js' => 'ab8d2723', 'rsrc/js/application/phortune/phortune-credit-card-form.js' => '2290aeef', 'rsrc/js/application/policy/behavior-policy-control.js' => 'f3fef818', - 'rsrc/js/application/policy/behavior-policy-rule-editor.js' => '92918fcb', + 'rsrc/js/application/policy/behavior-policy-rule-editor.js' => '0ea85aa3', 'rsrc/js/application/ponder/behavior-votebox.js' => '4e9b766b', 'rsrc/js/application/projects/behavior-boards-dropdown.js' => '0ec56e1d', 'rsrc/js/application/projects/behavior-project-boards.js' => 'c6b95cbd', @@ -641,7 +641,7 @@ 'javelin-behavior-phui-object-box-tabs' => 'a3e2244e', 'javelin-behavior-phui-timeline-dropdown-menu' => '4d94d9c3', 'javelin-behavior-policy-control' => 'f3fef818', - 'javelin-behavior-policy-rule-editor' => '92918fcb', + 'javelin-behavior-policy-rule-editor' => '0ea85aa3', 'javelin-behavior-ponder-votebox' => '4e9b766b', 'javelin-behavior-project-boards' => 'c6b95cbd', 'javelin-behavior-project-create' => '065227cc', @@ -899,6 +899,17 @@ 3 => 'javelin-util', 4 => 'phabricator-notification-css', ), + '0ea85aa3' => array( + 0 => 'javelin-behavior', + 1 => 'multirow-row-manager', + 2 => 'javelin-dom', + 3 => 'javelin-util', + 4 => 'phabricator-prefab', + 5 => 'javelin-tokenizer', + 6 => 'javelin-typeahead', + 7 => 'javelin-typeahead-ondemand-source', + 8 => 'javelin-json', + ), '0ec56e1d' => array( 0 => 'javelin-behavior', 1 => 'javelin-dom', @@ -1450,17 +1461,6 @@ 1 => 'javelin-uri', 2 => 'phabricator-notification', ), - '92918fcb' => array( - 0 => 'javelin-behavior', - 1 => 'multirow-row-manager', - 2 => 'javelin-dom', - 3 => 'javelin-util', - 4 => 'phabricator-prefab', - 5 => 'javelin-tokenizer', - 6 => 'javelin-typeahead', - 7 => 'javelin-typeahead-preloaded-source', - 8 => 'javelin-json', - ), '92eb531d' => array( 0 => 'javelin-behavior', 1 => 'javelin-dom', 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 @@ -1910,6 +1910,7 @@ 'PhabricatorPeopleCalendarController' => 'applications/people/controller/PhabricatorPeopleCalendarController.php', 'PhabricatorPeopleController' => 'applications/people/controller/PhabricatorPeopleController.php', 'PhabricatorPeopleCreateController' => 'applications/people/controller/PhabricatorPeopleCreateController.php', + 'PhabricatorPeopleDatasource' => 'applications/people/typeahead/PhabricatorPeopleDatasource.php', 'PhabricatorPeopleDeleteController' => 'applications/people/controller/PhabricatorPeopleDeleteController.php', 'PhabricatorPeopleDisableController' => 'applications/people/controller/PhabricatorPeopleDisableController.php', 'PhabricatorPeopleEmpowerController' => 'applications/people/controller/PhabricatorPeopleEmpowerController.php', @@ -4711,6 +4712,7 @@ 'PhabricatorPeopleCalendarController' => 'PhabricatorPeopleController', 'PhabricatorPeopleController' => 'PhabricatorController', 'PhabricatorPeopleCreateController' => 'PhabricatorPeopleController', + 'PhabricatorPeopleDatasource' => 'PhabricatorTypeaheadDatasource', 'PhabricatorPeopleDeleteController' => 'PhabricatorPeopleController', 'PhabricatorPeopleDisableController' => 'PhabricatorPeopleController', 'PhabricatorPeopleEmpowerController' => 'PhabricatorPeopleController', diff --git a/src/applications/audit/query/PhabricatorCommitSearchEngine.php b/src/applications/audit/query/PhabricatorCommitSearchEngine.php --- a/src/applications/audit/query/PhabricatorCommitSearchEngine.php +++ b/src/applications/audit/query/PhabricatorCommitSearchEngine.php @@ -91,7 +91,7 @@ ->setValue(array_select_keys($handles, $auditor_phids))) ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/users/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('authors') ->setLabel(pht('Commit Authors')) ->setValue(array_select_keys($handles, $commit_author_phids))) diff --git a/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php b/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php --- a/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php +++ b/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php @@ -106,13 +106,13 @@ $form ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/accounts/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('creators') ->setLabel(pht('Created By')) ->setValue($creator_handles)) ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/accounts/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('invited') ->setLabel(pht('Invited')) ->setValue($invited_handles)) diff --git a/src/applications/conpherence/controller/ConpherenceNewController.php b/src/applications/conpherence/controller/ConpherenceNewController.php --- a/src/applications/conpherence/controller/ConpherenceNewController.php +++ b/src/applications/conpherence/controller/ConpherenceNewController.php @@ -82,7 +82,7 @@ ->setName('participants') ->setValue($participant_handles) ->setUser($user) - ->setDatasource('/typeahead/common/users/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setLabel(pht('To')) ->setError($e_participants)) ->appendChild( diff --git a/src/applications/conpherence/controller/ConpherenceUpdateController.php b/src/applications/conpherence/controller/ConpherenceUpdateController.php --- a/src/applications/conpherence/controller/ConpherenceUpdateController.php +++ b/src/applications/conpherence/controller/ConpherenceUpdateController.php @@ -206,7 +206,7 @@ id(new AphrontFormTokenizerControl()) ->setName('add_person') ->setUser($user) - ->setDatasource('/typeahead/common/users/')); + ->setDatasource(new PhabricatorPeopleDatasource())); require_celerity_resource('conpherence-update-css'); return id(new AphrontDialogView()) diff --git a/src/applications/countdown/query/PhabricatorCountdownSearchEngine.php b/src/applications/countdown/query/PhabricatorCountdownSearchEngine.php --- a/src/applications/countdown/query/PhabricatorCountdownSearchEngine.php +++ b/src/applications/countdown/query/PhabricatorCountdownSearchEngine.php @@ -51,7 +51,7 @@ $form ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/users/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('authors') ->setLabel(pht('Authors')) ->setValue($author_handles)) 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 @@ -143,13 +143,13 @@ id(new AphrontFormTokenizerControl()) ->setLabel(pht('Responsible Users')) ->setName('responsibles') - ->setDatasource('/typeahead/common/accounts/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setValue(array_select_keys($handles, $responsible_phids))) ->appendChild( id(new AphrontFormTokenizerControl()) ->setLabel(pht('Authors')) ->setName('authors') - ->setDatasource('/typeahead/common/accounts/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setValue(array_select_keys($handles, $author_phids))) ->appendChild( id(new AphrontFormTokenizerControl()) diff --git a/src/applications/diffusion/controller/DiffusionLintController.php b/src/applications/diffusion/controller/DiffusionLintController.php --- a/src/applications/diffusion/controller/DiffusionLintController.php +++ b/src/applications/diffusion/controller/DiffusionLintController.php @@ -112,7 +112,7 @@ ->setMethod('GET') ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/users/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setLimit(1) ->setName('owner') ->setLabel(pht('Owner')) 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 @@ -78,7 +78,7 @@ $form ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/users/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('users') ->setLabel(pht('Include Users')) ->setValue($user_handles)) diff --git a/src/applications/files/query/PhabricatorFileSearchEngine.php b/src/applications/files/query/PhabricatorFileSearchEngine.php --- a/src/applications/files/query/PhabricatorFileSearchEngine.php +++ b/src/applications/files/query/PhabricatorFileSearchEngine.php @@ -61,7 +61,7 @@ $form ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/users/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('authors') ->setLabel(pht('Authors')) ->setValue($author_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 @@ -596,12 +596,12 @@ 'arcanistprojects' => new DiffusionArcanistProjectDatasource(), 'package' => new PhabricatorOwnersPackageDatasource(), 'project' => new PhabricatorProjectDatasource(), + 'user' => new PhabricatorPeopleDatasource(), ); $sources = mpull($sources, 'getDatasourceURI'); $sources += array( 'email' => '/typeahead/common/mailable/', - 'user' => '/typeahead/common/accounts/', 'userorproject' => '/typeahead/common/accountsorprojects/', ); diff --git a/src/applications/herald/query/HeraldRuleSearchEngine.php b/src/applications/herald/query/HeraldRuleSearchEngine.php --- a/src/applications/herald/query/HeraldRuleSearchEngine.php +++ b/src/applications/herald/query/HeraldRuleSearchEngine.php @@ -71,7 +71,7 @@ $form ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/users/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('authors') ->setLabel(pht('Authors')) ->setValue($author_handles)) diff --git a/src/applications/legalpad/controller/LegalpadDocumentSignatureAddController.php b/src/applications/legalpad/controller/LegalpadDocumentSignatureAddController.php --- a/src/applications/legalpad/controller/LegalpadDocumentSignatureAddController.php +++ b/src/applications/legalpad/controller/LegalpadDocumentSignatureAddController.php @@ -130,7 +130,7 @@ ->setLabel(pht('Exempt User')) ->setName('users') ->setLimit(1) - ->setDatasource('/typeahead/common/users/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setValue($user_handles) ->setError($e_user)); } else { diff --git a/src/applications/legalpad/query/LegalpadDocumentSearchEngine.php b/src/applications/legalpad/query/LegalpadDocumentSearchEngine.php --- a/src/applications/legalpad/query/LegalpadDocumentSearchEngine.php +++ b/src/applications/legalpad/query/LegalpadDocumentSearchEngine.php @@ -95,13 +95,13 @@ ->setDisabled(!$this->requireViewer()->getPHID())) ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/users/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('creators') ->setLabel(pht('Creators')) ->setValue(array_select_keys($handles, $creator_phids))) ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/users/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('contributors') ->setLabel(pht('Contributors')) ->setValue(array_select_keys($handles, $contributor_phids))); diff --git a/src/applications/legalpad/query/LegalpadDocumentSignatureSearchEngine.php b/src/applications/legalpad/query/LegalpadDocumentSignatureSearchEngine.php --- a/src/applications/legalpad/query/LegalpadDocumentSignatureSearchEngine.php +++ b/src/applications/legalpad/query/LegalpadDocumentSignatureSearchEngine.php @@ -99,7 +99,7 @@ $form ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/users/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('signers') ->setLabel(pht('Signers')) ->setValue(array_select_keys($handles, $signer_phids))) diff --git a/src/applications/macro/query/PhabricatorMacroSearchEngine.php b/src/applications/macro/query/PhabricatorMacroSearchEngine.php --- a/src/applications/macro/query/PhabricatorMacroSearchEngine.php +++ b/src/applications/macro/query/PhabricatorMacroSearchEngine.php @@ -93,7 +93,7 @@ ->setValue($status)) ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/users/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('authors') ->setLabel(pht('Authors')) ->setValue($author_handles)) 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 @@ -283,6 +283,7 @@ ); $projects_source = new PhabricatorProjectDatasource(); + $users_source = new PhabricatorPeopleDatasource(); $tokenizer_map = array( ManiphestTransaction::TYPE_PROJECTS => array( @@ -292,10 +293,10 @@ ), ManiphestTransaction::TYPE_OWNER => array( 'id' => 'assign-tokenizer', - 'src' => '/typeahead/common/users/', + 'src' => $users_source->getDatasourceURI(), 'value' => $default_claim, 'limit' => 1, - 'placeholder' => pht('Type a user name...'), + 'placeholder' => $users_source->getPlaceholderText(), ), ManiphestTransaction::TYPE_CCS => array( 'id' => 'cc-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 @@ -602,7 +602,7 @@ ->setName('assigned_to') ->setValue($assigned_value) ->setUser($user) - ->setDatasource('/typeahead/common/users/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setLimit(1)); } 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 @@ -309,7 +309,7 @@ $form ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/accounts/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('assigned') ->setLabel(pht('Assigned To')) ->setValue($assigned_handles)) @@ -353,13 +353,13 @@ ->setValue($exclude_project_handles)) ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/accounts/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('userProjects') ->setLabel(pht('In Users\' Projects')) ->setValue($user_project_handles)) ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/accounts/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('authors') ->setLabel(pht('Authors')) ->setValue($author_handles)) diff --git a/src/applications/oauthserver/query/PhabricatorOAuthServerClientSearchEngine.php b/src/applications/oauthserver/query/PhabricatorOAuthServerClientSearchEngine.php --- a/src/applications/oauthserver/query/PhabricatorOAuthServerClientSearchEngine.php +++ b/src/applications/oauthserver/query/PhabricatorOAuthServerClientSearchEngine.php @@ -45,7 +45,7 @@ $form ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/users/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('creators') ->setLabel(pht('Creators')) ->setValue($creator_handles)); diff --git a/src/applications/paste/query/PhabricatorPasteSearchEngine.php b/src/applications/paste/query/PhabricatorPasteSearchEngine.php --- a/src/applications/paste/query/PhabricatorPasteSearchEngine.php +++ b/src/applications/paste/query/PhabricatorPasteSearchEngine.php @@ -67,7 +67,7 @@ $form ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/users/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('authors') ->setLabel(pht('Authors')) ->setValue($author_handles)) diff --git a/src/applications/people/query/PhabricatorPeopleLogSearchEngine.php b/src/applications/people/query/PhabricatorPeopleLogSearchEngine.php --- a/src/applications/people/query/PhabricatorPeopleLogSearchEngine.php +++ b/src/applications/people/query/PhabricatorPeopleLogSearchEngine.php @@ -124,13 +124,13 @@ $form ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/accounts/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('actors') ->setLabel(pht('Actors')) ->setValue($actor_handles)) ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/accounts/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('users') ->setLabel(pht('Users')) ->setValue($user_handles)) diff --git a/src/applications/people/typeahead/PhabricatorPeopleDatasource.php b/src/applications/people/typeahead/PhabricatorPeopleDatasource.php new file mode 100644 --- /dev/null +++ b/src/applications/people/typeahead/PhabricatorPeopleDatasource.php @@ -0,0 +1,121 @@ +getViewer(); + $raw_query = $this->getRawQuery(); + + $results = array(); + + $users = array(); + if (strlen($raw_query)) { + // This is an arbitrary limit which is just larger than any limit we + // actually use in the application. + + // TODO: The datasource should pass this in the query. + $limit = 15; + + $user_table = new PhabricatorUser(); + $conn_r = $user_table->establishConnection('r'); + $ids = queryfx_all( + $conn_r, + 'SELECT id FROM %T WHERE username LIKE %> + ORDER BY username ASC LIMIT %d', + $user_table->getTableName(), + $raw_query, + $limit); + $ids = ipull($ids, 'id'); + + if (count($ids) < $limit) { + // If we didn't find enough username hits, look for real name hits. + // We need to pull the entire pagesize so that we end up with the + // right number of items if this query returns many duplicate IDs + // that we've already selected. + + $realname_ids = queryfx_all( + $conn_r, + 'SELECT DISTINCT userID FROM %T WHERE token LIKE %> + ORDER BY token ASC LIMIT %d', + PhabricatorUser::NAMETOKEN_TABLE, + $raw_query, + $limit); + $realname_ids = ipull($realname_ids, 'userID'); + $ids = array_merge($ids, $realname_ids); + + $ids = array_unique($ids); + $ids = array_slice($ids, 0, $limit); + } + + // Always add the logged-in user because some tokenizers autosort them + // first. They'll be filtered out on the client side if they don't + // match the query. + if ($viewer->getID()) { + $ids[] = $viewer->getID(); + } + + if ($ids) { + $users = id(new PhabricatorPeopleQuery()) + ->setViewer($viewer) + ->withIDs($ids) + ->execute(); + } + } + + // TODO: Restore this when mainsearch moves here. + /* + + if ($need_rich_data) { + $phids = mpull($users, 'getPHID'); + $handles = $this->loadViewerHandles($phids); + } + + */ + + foreach ($users as $user) { + $closed = null; + if ($user->getIsDisabled()) { + $closed = pht('Disabled'); + } else if ($user->getIsSystemAgent()) { + $closed = pht('Bot/Script'); + } + + $result = id(new PhabricatorTypeaheadResult()) + ->setName($user->getFullName()) + ->setURI('/p/'.$user->getUsername()) + ->setPHID($user->getPHID()) + ->setPriorityString($user->getUsername()) + ->setIcon('fa-user bluegrey') + ->setPriorityType('user') + ->setClosed($closed); + + // TODO: Restore this too. + /* + + if ($need_rich_data) { + $display_type = 'User'; + if ($user->getIsAdmin()) { + $display_type = 'Administrator'; + } + $result->setDisplayType($display_type); + $result->setImageURI($handles[$user->getPHID()]->getImageURI()); + } + + */ + + $results[] = $result; + } + + return $results; + } + +} diff --git a/src/applications/pholio/query/PholioMockSearchEngine.php b/src/applications/pholio/query/PholioMockSearchEngine.php --- a/src/applications/pholio/query/PholioMockSearchEngine.php +++ b/src/applications/pholio/query/PholioMockSearchEngine.php @@ -55,7 +55,7 @@ $form ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/users/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('authors') ->setLabel(pht('Authors')) ->setValue($author_handles)) diff --git a/src/applications/phrequent/query/PhrequentSearchEngine.php b/src/applications/phrequent/query/PhrequentSearchEngine.php --- a/src/applications/phrequent/query/PhrequentSearchEngine.php +++ b/src/applications/phrequent/query/PhrequentSearchEngine.php @@ -69,7 +69,7 @@ $form ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/users/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('users') ->setLabel(pht('Users')) ->setValue($handles)) diff --git a/src/applications/policy/rule/PhabricatorPolicyRuleUsers.php b/src/applications/policy/rule/PhabricatorPolicyRuleUsers.php --- a/src/applications/policy/rule/PhabricatorPolicyRuleUsers.php +++ b/src/applications/policy/rule/PhabricatorPolicyRuleUsers.php @@ -21,10 +21,12 @@ } public function getValueControlTemplate() { + $users_datasource = new PhabricatorPeopleDatasource(); + return array( 'markup' => new AphrontTokenizerTemplateView(), - 'uri' => '/typeahead/common/accounts/', - 'placeholder' => pht('Type a user name...'), + 'uri' => $users_datasource->getDatasourceURI(), + 'placeholder' => $users_datasource->getPlaceholderText(), ); } diff --git a/src/applications/ponder/query/PonderQuestionSearchEngine.php b/src/applications/ponder/query/PonderQuestionSearchEngine.php --- a/src/applications/ponder/query/PonderQuestionSearchEngine.php +++ b/src/applications/ponder/query/PonderQuestionSearchEngine.php @@ -73,13 +73,13 @@ $form ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/users/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('authors') ->setLabel(pht('Authors')) ->setValue(array_select_keys($handles, $author_phids))) ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/users/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('answerers') ->setLabel(pht('Answered By')) ->setValue(array_select_keys($handles, $answerer_phids))) diff --git a/src/applications/project/controller/PhabricatorProjectMembersEditController.php b/src/applications/project/controller/PhabricatorProjectMembersEditController.php --- a/src/applications/project/controller/PhabricatorProjectMembersEditController.php +++ b/src/applications/project/controller/PhabricatorProjectMembersEditController.php @@ -83,7 +83,7 @@ id(new AphrontFormTokenizerControl()) ->setName('phids') ->setLabel(pht('Add Members')) - ->setDatasource('/typeahead/common/accounts/')) + ->setDatasource(new PhabricatorPeopleDatasource())) ->appendChild( id(new AphrontFormSubmitControl()) ->addCancelButton('/project/view/'.$project->getID().'/') diff --git a/src/applications/project/query/PhabricatorProjectSearchEngine.php b/src/applications/project/query/PhabricatorProjectSearchEngine.php --- a/src/applications/project/query/PhabricatorProjectSearchEngine.php +++ b/src/applications/project/query/PhabricatorProjectSearchEngine.php @@ -63,7 +63,7 @@ $form ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/users/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('members') ->setLabel(pht('Members')) ->setValue($member_handles)) diff --git a/src/applications/releeph/controller/product/ReleephProductEditController.php b/src/applications/releeph/controller/product/ReleephProductEditController.php --- a/src/applications/releeph/controller/product/ReleephProductEditController.php +++ b/src/applications/releeph/controller/product/ReleephProductEditController.php @@ -194,7 +194,7 @@ id(new AphrontFormTokenizerControl()) ->setLabel(pht('Pushers')) ->setName('pushers') - ->setDatasource('/typeahead/common/users/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setValue($pusher_handles)) ->appendChild($branch_template_input) ->appendChild($branch_template_preview) diff --git a/src/applications/releeph/query/ReleephRequestSearchEngine.php b/src/applications/releeph/query/ReleephRequestSearchEngine.php --- a/src/applications/releeph/query/ReleephRequestSearchEngine.php +++ b/src/applications/releeph/query/ReleephRequestSearchEngine.php @@ -84,7 +84,7 @@ ->setOptions($this->getSeverityOptions())) ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/users/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('requestors') ->setLabel(pht('Requestors')) ->setValue($requestor_handles)); diff --git a/src/applications/repository/query/PhabricatorRepositoryPushLogSearchEngine.php b/src/applications/repository/query/PhabricatorRepositoryPushLogSearchEngine.php --- a/src/applications/repository/query/PhabricatorRepositoryPushLogSearchEngine.php +++ b/src/applications/repository/query/PhabricatorRepositoryPushLogSearchEngine.php @@ -80,7 +80,7 @@ ->setValue($repository_handles)) ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/accounts/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('pushers') ->setLabel(pht('Pushers')) ->setValue($pusher_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 @@ -136,7 +136,7 @@ id(new AphrontFormTokenizerControl()) ->setName('authorPHIDs') ->setLabel('Authors') - ->setDatasource('/typeahead/common/users/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setValue($author_handles)) ->appendChild( id(new AphrontFormTokenizerControl()) @@ -155,7 +155,7 @@ id(new AphrontFormTokenizerControl()) ->setName('subscriberPHIDs') ->setLabel('Subscribers') - ->setDatasource('/typeahead/common/users/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setValue($subscriber_handles)) ->appendChild( id(new AphrontFormTokenizerControl()) diff --git a/src/applications/slowvote/query/PhabricatorSlowvoteSearchEngine.php b/src/applications/slowvote/query/PhabricatorSlowvoteSearchEngine.php --- a/src/applications/slowvote/query/PhabricatorSlowvoteSearchEngine.php +++ b/src/applications/slowvote/query/PhabricatorSlowvoteSearchEngine.php @@ -55,7 +55,7 @@ $form ->appendChild( id(new AphrontFormTokenizerControl()) - ->setDatasource('/typeahead/common/users/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('authors') ->setLabel(pht('Authors')) ->setValue($author_handles)) 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 @@ -48,11 +48,6 @@ $need_projs = true; $need_noproject = true; break; - case 'users': - case 'accounts': - case 'authors': - $need_users = true; - break; case 'mailable': case 'allmailable': $need_users = true; 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 @@ -18,7 +18,7 @@ $control = id(new AphrontFormTokenizerControl()) ->setLabel($this->getFieldName()) ->setName($this->getFieldKey()) - ->setDatasource('/typeahead/common/accounts/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setCaption($this->getCaption()) ->setValue($control_value); @@ -39,7 +39,7 @@ $control = id(new AphrontFormTokenizerControl()) ->setLabel($this->getFieldName()) ->setName($this->getFieldKey()) - ->setDatasource('/typeahead/common/accounts/') + ->setDatasource(new PhabricatorPeopleDatasource()) ->setValue($handles); $form->appendChild($control); diff --git a/webroot/rsrc/js/application/policy/behavior-policy-rule-editor.js b/webroot/rsrc/js/application/policy/behavior-policy-rule-editor.js --- a/webroot/rsrc/js/application/policy/behavior-policy-rule-editor.js +++ b/webroot/rsrc/js/application/policy/behavior-policy-rule-editor.js @@ -7,7 +7,7 @@ * phabricator-prefab * javelin-tokenizer * javelin-typeahead - * javelin-typeahead-preloaded-source + * javelin-typeahead-ondemand-source * javelin-json */ JX.behavior('policy-rule-editor', function(config) { @@ -124,7 +124,7 @@ node = JX.$H(template.markup).getNode(); node.id = ''; - var datasource = new JX.TypeaheadPreloadedSource(template.uri); + var datasource = new JX.TypeaheadOnDemandSource(template.uri); var typeahead = new JX.Typeahead(node); typeahead.setDatasource(datasource);