@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Make project token sorting and normalization a little less hacky

Summary:
Ref T8510. Use "\n" as a delimiter between name sections. Specifically, project "AAA" with tag "zzz" should be a better match for query "AAA" than project "AAA BBB" is.

Make use of this delimiter slighlty more obvious in the UI.

Test Plan:
- Created projects "Phacility" and "Phacility Core Access".
- Typed "Phacility".
- Before patch: first hit is "Phacility Core Access".
- After patch: first hit is "Phacility".
- Viewed debugging output table, saw visual explanation of behavior.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T8510

Differential Revision: https://secure.phabricator.com/D16886

+16 -12
+6 -6
resources/celerity/map.php
··· 10 10 'conpherence.pkg.css' => '0b64e988', 11 11 'conpherence.pkg.js' => '6249a1cf', 12 12 'core.pkg.css' => '2f1ecc57', 13 - 'core.pkg.js' => '56f967a5', 13 + 'core.pkg.js' => 'f0648ee7', 14 14 'darkconsole.pkg.js' => 'e7393ebb', 15 15 'differential.pkg.css' => 'a4ba74b5', 16 16 'differential.pkg.js' => '634399e9', ··· 261 261 'rsrc/externals/javelin/lib/behavior.js' => '61cbc29a', 262 262 'rsrc/externals/javelin/lib/control/tokenizer/Tokenizer.js' => '8d3bc1b2', 263 263 'rsrc/externals/javelin/lib/control/typeahead/Typeahead.js' => '70baed2f', 264 - 'rsrc/externals/javelin/lib/control/typeahead/normalizer/TypeaheadNormalizer.js' => 'e6e25838', 264 + 'rsrc/externals/javelin/lib/control/typeahead/normalizer/TypeaheadNormalizer.js' => '185bbd53', 265 265 'rsrc/externals/javelin/lib/control/typeahead/source/TypeaheadCompositeSource.js' => '503e17fd', 266 266 'rsrc/externals/javelin/lib/control/typeahead/source/TypeaheadOnDemandSource.js' => '013ffff9', 267 267 'rsrc/externals/javelin/lib/control/typeahead/source/TypeaheadPreloadedSource.js' => '54f314a0', ··· 747 747 'javelin-tokenizer' => '8d3bc1b2', 748 748 'javelin-typeahead' => '70baed2f', 749 749 'javelin-typeahead-composite-source' => '503e17fd', 750 - 'javelin-typeahead-normalizer' => 'e6e25838', 750 + 'javelin-typeahead-normalizer' => '185bbd53', 751 751 'javelin-typeahead-ondemand-source' => '013ffff9', 752 752 'javelin-typeahead-preloaded-source' => '54f314a0', 753 753 'javelin-typeahead-source' => '0fcf201c', ··· 1036 1036 'javelin-stratcom', 1037 1037 'javelin-workflow', 1038 1038 'javelin-workboard-controller', 1039 + ), 1040 + '185bbd53' => array( 1041 + 'javelin-install', 1039 1042 ), 1040 1043 '1aa4c968' => array( 1041 1044 'javelin-behavior', ··· 2120 2123 'javelin-json', 2121 2124 'javelin-workflow', 2122 2125 'javelin-magical-init', 2123 - ), 2124 - 'e6e25838' => array( 2125 - 'javelin-install', 2126 2126 ), 2127 2127 'e9581f08' => array( 2128 2128 'javelin-behavior',
+1 -6
src/applications/project/typeahead/PhabricatorProjectDatasource.php
··· 103 103 104 104 $all_strings = array(); 105 105 $all_strings[] = $proj->getDisplayName(); 106 - 107 - // Add an extra space after the name so that the original project 108 - // sorts ahead of milestones. This is kind of a hack but ehh? 109 - $all_strings[] = null; 110 - 111 106 foreach ($proj->getSlugs() as $project_slug) { 112 107 $all_strings[] = $project_slug->getSlug(); 113 108 } 114 - $all_strings = implode(' ', $all_strings); 109 + $all_strings = implode("\n", $all_strings); 115 110 116 111 $proj_result = id(new PhabricatorTypeaheadResult()) 117 112 ->setName($all_strings)
+5
src/applications/typeahead/controller/PhabricatorTypeaheadModularDatasourceController.php
··· 311 311 ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) 312 312 ->setForm($form); 313 313 314 + // Make "\n" delimiters more visible. 315 + foreach ($content as $key => $row) { 316 + $content[$key][0] = str_replace("\n", '<\n>', $row[0]); 317 + } 318 + 314 319 $table = new AphrontTableView($content); 315 320 $table->setHeaders( 316 321 array(
+4
webroot/rsrc/externals/javelin/lib/control/typeahead/normalizer/TypeaheadNormalizer.js
··· 18 18 // NOTE: We specifically normalize "(" and ")" into spaces so that 19 19 // we can match tokenizer functions like "members(project)". 20 20 21 + // NOTE: We specifically do NOT normalize "\n" because it is used as 22 + // a delimiter between components of typeahead result names, like the 23 + // name of a project and its tags. 24 + 21 25 return ('' + str) 22 26 .toLocaleLowerCase() 23 27 .replace(/[\.,\/#!$%\^&\*;:{}=_`~]/g, '')