diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 61dc140a36..e1f7fd6420 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -8,8 +8,8 @@ return array( 'names' => array( 'core.pkg.css' => 'f7d01efc', - 'core.pkg.js' => 'a1f9db42', - 'darkconsole.pkg.js' => '8ab24e01', + 'core.pkg.js' => 'd3f3a35c', + 'darkconsole.pkg.js' => 'b0a3ba93', 'differential.pkg.css' => '3500921f', 'differential.pkg.js' => 'c0506961', 'diffusion.pkg.css' => '591664fa', @@ -350,7 +350,7 @@ return array( 'rsrc/image/texture/table_header_hover.png' => '038ec3b9', 'rsrc/image/texture/table_header_tall.png' => 'd56b434f', 'rsrc/js/application/aphlict/Aphlict.js' => '30a6303c', - 'rsrc/js/application/aphlict/behavior-aphlict-dropdown.js' => '572566ae', + 'rsrc/js/application/aphlict/behavior-aphlict-dropdown.js' => 'ee37f73a', 'rsrc/js/application/aphlict/behavior-aphlict-listen.js' => 'b1a59974', 'rsrc/js/application/aphlict/behavior-aphlict-status.js' => 'ea681761', 'rsrc/js/application/auth/behavior-persona-login.js' => '9414ff18', @@ -460,7 +460,7 @@ return array( 'rsrc/js/core/behavior-autofocus.js' => '7319e029', 'rsrc/js/core/behavior-choose-control.js' => '6153c708', 'rsrc/js/core/behavior-crop.js' => 'fa0f4fc2', - 'rsrc/js/core/behavior-dark-console.js' => '08883e8b', + 'rsrc/js/core/behavior-dark-console.js' => 'b8df5663', 'rsrc/js/core/behavior-device.js' => 'a205cf28', 'rsrc/js/core/behavior-drag-and-drop-textarea.js' => '6d49590e', 'rsrc/js/core/behavior-error-log.js' => '6882e80a', @@ -550,7 +550,7 @@ return array( 'inline-comment-summary-css' => 'eb5f8e8c', 'javelin-aphlict' => '30a6303c', 'javelin-behavior' => '61cbc29a', - 'javelin-behavior-aphlict-dropdown' => '572566ae', + 'javelin-behavior-aphlict-dropdown' => 'ee37f73a', 'javelin-behavior-aphlict-listen' => 'b1a59974', 'javelin-behavior-aphlict-status' => 'ea681761', 'javelin-behavior-aphront-basic-tokenizer' => 'b3a4b884', @@ -567,7 +567,7 @@ return array( 'javelin-behavior-conpherence-pontificate' => '21ba5861', 'javelin-behavior-conpherence-widget-pane' => '93568464', 'javelin-behavior-countdown-timer' => 'e4cc26b3', - 'javelin-behavior-dark-console' => '08883e8b', + 'javelin-behavior-dark-console' => 'b8df5663', 'javelin-behavior-dashboard-async-panel' => '469c0d9e', 'javelin-behavior-dashboard-move-panels' => '82439934', 'javelin-behavior-dashboard-query-panel-select' => '453c5375', @@ -869,14 +869,6 @@ return array( 'phabricator-shaped-request', 'conpherence-thread-manager', ), - '08883e8b' => array( - 'javelin-behavior', - 'javelin-stratcom', - 'javelin-util', - 'javelin-dom', - 'javelin-request', - 'phabricator-keyboard-shortcut', - ), '0a3f3021' => array( 'javelin-behavior', 'javelin-stratcom', @@ -1198,16 +1190,6 @@ return array( 'javelin-vector', 'javelin-dom', ), - '572566ae' => array( - 'javelin-behavior', - 'javelin-request', - 'javelin-stratcom', - 'javelin-vector', - 'javelin-dom', - 'javelin-uri', - 'javelin-behavior-device', - 'phabricator-title', - ), 58562350 => array( 'javelin-dom', 'javelin-util', @@ -1727,6 +1709,14 @@ return array( 'javelin-dom', 'javelin-util', ), + 'b8df5663' => array( + 'javelin-behavior', + 'javelin-stratcom', + 'javelin-util', + 'javelin-dom', + 'javelin-request', + 'phabricator-keyboard-shortcut', + ), 'bba9eedf' => array( 'javelin-behavior', 'javelin-stratcom', @@ -1950,6 +1940,16 @@ return array( 'javelin-stratcom', 'javelin-vector', ), + 'ee37f73a' => array( + 'javelin-behavior', + 'javelin-request', + 'javelin-stratcom', + 'javelin-vector', + 'javelin-dom', + 'javelin-uri', + 'javelin-behavior-device', + 'phabricator-title', + ), 'efe49472' => array( 'javelin-install', 'javelin-util', diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index e4a6bcdf04..2098a28b73 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -2475,6 +2475,7 @@ phutil_register_library_map(array( 'PhabricatorSearchDocumentIndexer' => 'applications/search/index/PhabricatorSearchDocumentIndexer.php', 'PhabricatorSearchDocumentQuery' => 'applications/search/query/PhabricatorSearchDocumentQuery.php', 'PhabricatorSearchDocumentRelationship' => 'applications/search/storage/document/PhabricatorSearchDocumentRelationship.php', + 'PhabricatorSearchDocumentTypeDatasource' => 'applications/search/typeahead/PhabricatorSearchDocumentTypeDatasource.php', 'PhabricatorSearchEditController' => 'applications/search/controller/PhabricatorSearchEditController.php', 'PhabricatorSearchEngine' => 'applications/search/engine/PhabricatorSearchEngine.php', 'PhabricatorSearchEngineElastic' => 'applications/search/engine/PhabricatorSearchEngineElastic.php', @@ -5897,6 +5898,7 @@ phutil_register_library_map(array( 'PhabricatorSearchDocumentIndexer' => 'Phobject', 'PhabricatorSearchDocumentQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'PhabricatorSearchDocumentRelationship' => 'PhabricatorSearchDAO', + 'PhabricatorSearchDocumentTypeDatasource' => 'PhabricatorTypeaheadDatasource', 'PhabricatorSearchEditController' => 'PhabricatorSearchBaseController', 'PhabricatorSearchEngineElastic' => 'PhabricatorSearchEngine', 'PhabricatorSearchEngineMySQL' => 'PhabricatorSearchEngine', diff --git a/src/applications/conpherence/phid/PhabricatorConpherenceThreadPHIDType.php b/src/applications/conpherence/phid/PhabricatorConpherenceThreadPHIDType.php index 6bfbd611a9..86dbad6307 100644 --- a/src/applications/conpherence/phid/PhabricatorConpherenceThreadPHIDType.php +++ b/src/applications/conpherence/phid/PhabricatorConpherenceThreadPHIDType.php @@ -12,6 +12,10 @@ final class PhabricatorConpherenceThreadPHIDType extends PhabricatorPHIDType { return new ConpherenceThread(); } + public function getPHIDTypeApplicationClass() { + return 'PhabricatorConpherenceApplication'; + } + protected function buildQueryForObjects( PhabricatorObjectQuery $query, array $phids) { diff --git a/src/applications/fund/phid/FundInitiativePHIDType.php b/src/applications/fund/phid/FundInitiativePHIDType.php index b0e384c063..4d7fbc04e1 100644 --- a/src/applications/fund/phid/FundInitiativePHIDType.php +++ b/src/applications/fund/phid/FundInitiativePHIDType.php @@ -12,6 +12,10 @@ final class FundInitiativePHIDType extends PhabricatorPHIDType { return new FundInitiative(); } + public function getPHIDTypeApplicationClass() { + return 'PhabricatorFundApplication'; + } + protected function buildQueryForObjects( PhabricatorObjectQuery $query, array $phids) { diff --git a/src/applications/herald/adapter/HeraldCommitAdapter.php b/src/applications/herald/adapter/HeraldCommitAdapter.php index 4ca916d13a..eeb43c7a95 100644 --- a/src/applications/herald/adapter/HeraldCommitAdapter.php +++ b/src/applications/herald/adapter/HeraldCommitAdapter.php @@ -26,7 +26,7 @@ final class HeraldCommitAdapter extends HeraldAdapter { return 'PhabricatorDiffusionApplication'; } - public function newObject() { + protected function newObject() { return new PhabricatorRepositoryCommit(); } diff --git a/src/applications/herald/adapter/HeraldDifferentialRevisionAdapter.php b/src/applications/herald/adapter/HeraldDifferentialRevisionAdapter.php index 3ad5c4722e..3168b29f66 100644 --- a/src/applications/herald/adapter/HeraldDifferentialRevisionAdapter.php +++ b/src/applications/herald/adapter/HeraldDifferentialRevisionAdapter.php @@ -24,7 +24,7 @@ final class HeraldDifferentialRevisionAdapter return 'PhabricatorDifferentialApplication'; } - public function newObject() { + protected function newObject() { return new DifferentialRevision(); } diff --git a/src/applications/herald/adapter/HeraldPholioMockAdapter.php b/src/applications/herald/adapter/HeraldPholioMockAdapter.php index 1ba96c56ed..0b73b6cfc2 100644 --- a/src/applications/herald/adapter/HeraldPholioMockAdapter.php +++ b/src/applications/herald/adapter/HeraldPholioMockAdapter.php @@ -13,7 +13,7 @@ final class HeraldPholioMockAdapter extends HeraldAdapter { return pht('React to mocks being created or updated.'); } - public function newObject() { + protected function newObject() { return new PholioMock(); } diff --git a/src/applications/passphrase/phid/PassphraseCredentialPHIDType.php b/src/applications/passphrase/phid/PassphraseCredentialPHIDType.php index e4d6e4104a..212afd940f 100644 --- a/src/applications/passphrase/phid/PassphraseCredentialPHIDType.php +++ b/src/applications/passphrase/phid/PassphraseCredentialPHIDType.php @@ -12,6 +12,10 @@ final class PassphraseCredentialPHIDType extends PhabricatorPHIDType { return new PassphraseCredential(); } + public function getPHIDTypeApplicationClass() { + return 'PhabricatorPassphraseApplication'; + } + protected function buildQueryForObjects( PhabricatorObjectQuery $query, array $phids) { diff --git a/src/applications/phid/type/PhabricatorPHIDType.php b/src/applications/phid/type/PhabricatorPHIDType.php index 221048f93b..4445ab863d 100644 --- a/src/applications/phid/type/PhabricatorPHIDType.php +++ b/src/applications/phid/type/PhabricatorPHIDType.php @@ -31,6 +31,13 @@ abstract class PhabricatorPHIDType { } public function getTypeIcon() { + // Default to the application icon if the type doesn't specify one. + $application_class = $this->getPHIDTypeApplicationClass(); + if ($application_class) { + $application = newv($application_class, array()); + return $application->getFontIcon(); + } + return null; } diff --git a/src/applications/phriction/herald/PhrictionDocumentHeraldAdapter.php b/src/applications/phriction/herald/PhrictionDocumentHeraldAdapter.php index 3946f191cb..8b6d36edf6 100644 --- a/src/applications/phriction/herald/PhrictionDocumentHeraldAdapter.php +++ b/src/applications/phriction/herald/PhrictionDocumentHeraldAdapter.php @@ -13,7 +13,7 @@ final class PhrictionDocumentHeraldAdapter extends HeraldAdapter { return pht('React to wiki documents being created or updated.'); } - public function newObject() { + protected function newObject() { return new PhrictionDocument(); } diff --git a/src/applications/search/query/PhabricatorSearchApplicationSearchEngine.php b/src/applications/search/query/PhabricatorSearchApplicationSearchEngine.php index 3ff952245b..d362c21a83 100644 --- a/src/applications/search/query/PhabricatorSearchApplicationSearchEngine.php +++ b/src/applications/search/query/PhabricatorSearchApplicationSearchEngine.php @@ -88,17 +88,11 @@ final class PhabricatorSearchApplicationSearchEngine $type_values = $saved->getParameter('types', array()); $type_values = array_fuse($type_values); - $types = self::getIndexableDocumentTypes($this->requireViewer()); - - $types_control = id(new AphrontFormCheckboxControl()) - ->setLabel(pht('Document Types')); - foreach ($types as $type => $name) { - $types_control->addCheckbox( - 'types[]', - $type, - $name, - isset($type_values[$type])); - } + $types_control = id(new AphrontFormTokenizerControl()) + ->setLabel(pht('Document Types')) + ->setName('types') + ->setDatasource(new PhabricatorSearchDocumentTypeDatasource()) + ->setValue($type_values); $form ->appendChild( @@ -115,7 +109,7 @@ final class PhabricatorSearchApplicationSearchEngine ->setName('query') ->setValue($saved->getParameter('query'))) ->appendChild($status_control) - ->appendChild($types_control) + ->appendControl($types_control) ->appendControl( id(new AphrontFormTokenizerControl()) ->setName('authorPHIDs') @@ -208,13 +202,6 @@ final class PhabricatorSearchApplicationSearchEngine asort($results); - // Put tasks first, see T4606. - $results = array_select_keys( - $results, - array( - ManiphestTaskPHIDType::TYPECONST, - )) + $results; - return $results; } diff --git a/src/applications/search/typeahead/PhabricatorSearchDocumentTypeDatasource.php b/src/applications/search/typeahead/PhabricatorSearchDocumentTypeDatasource.php new file mode 100644 index 0000000000..511363e7ed --- /dev/null +++ b/src/applications/search/typeahead/PhabricatorSearchDocumentTypeDatasource.php @@ -0,0 +1,56 @@ +buildResults(); + return $this->filterResultsAgainstTokens($results); + } + + public function renderTokens(array $values) { + $results = $this->buildResults(); + $results = array_select_keys($results, $values); + + $tokens = array(); + foreach ($results as $result) { + $tokens[] = PhabricatorTypeaheadTokenView::newFromTypeaheadResult( + $result); + } + + return $tokens; + } + + private function buildResults() { + $types = + PhabricatorSearchApplicationSearchEngine::getIndexableDocumentTypes(); + + $icons = mpull( + PhabricatorPHIDType::getAllTypes(), + 'getTypeIcon', + 'getTypeConstant'); + + $results = array(); + foreach ($types as $type => $name) { + $results[$type] = id(new PhabricatorTypeaheadResult()) + ->setPHID($type) + ->setName($name) + ->setIcon(idx($icons, $type)); + } + + return $results; + } + +}