@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.

Support tokenizer functions in Diffusion

Summary: Ref T4100. Ref T5595. Support tokenizer functions + edgelogic for repositories.

Test Plan: Searched for repositories.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T5595, T4100

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

+67 -50
+9 -9
resources/celerity/map.php
··· 8 8 return array( 9 9 'names' => array( 10 10 'core.pkg.css' => '9a9b59ca', 11 - 'core.pkg.js' => '80671b76', 11 + 'core.pkg.js' => '348d5193', 12 12 'darkconsole.pkg.js' => '8ab24e01', 13 13 'differential.pkg.css' => '3500921f', 14 14 'differential.pkg.js' => 'c0506961', ··· 222 222 'rsrc/externals/javelin/lib/__tests__/URI.js' => '1e45fda9', 223 223 'rsrc/externals/javelin/lib/__tests__/behavior.js' => '1ea62783', 224 224 'rsrc/externals/javelin/lib/behavior.js' => '61cbc29a', 225 - 'rsrc/externals/javelin/lib/control/tokenizer/Tokenizer.js' => '3ff74d77', 225 + 'rsrc/externals/javelin/lib/control/tokenizer/Tokenizer.js' => 'ab5f468d', 226 226 'rsrc/externals/javelin/lib/control/typeahead/Typeahead.js' => '70baed2f', 227 227 'rsrc/externals/javelin/lib/control/typeahead/normalizer/TypeaheadNormalizer.js' => 'e6e25838', 228 228 'rsrc/externals/javelin/lib/control/typeahead/source/TypeaheadCompositeSource.js' => '503e17fd', ··· 689 689 'javelin-scrollbar' => 'eaa5b321', 690 690 'javelin-sound' => '949c0fe5', 691 691 'javelin-stratcom' => '6c53634d', 692 - 'javelin-tokenizer' => '3ff74d77', 692 + 'javelin-tokenizer' => 'ab5f468d', 693 693 'javelin-typeahead' => '70baed2f', 694 694 'javelin-typeahead-composite-source' => '503e17fd', 695 695 'javelin-typeahead-normalizer' => 'e6e25838', ··· 1080 1080 'javelin-dom', 1081 1081 'phortune-credit-card-form', 1082 1082 ), 1083 - '3ff74d77' => array( 1084 - 'javelin-dom', 1085 - 'javelin-util', 1086 - 'javelin-stratcom', 1087 - 'javelin-install', 1088 - ), 1089 1083 '40a6a403' => array( 1090 1084 'javelin-install', 1091 1085 'javelin-dom', ··· 1668 1662 'javelin-dom', 1669 1663 'javelin-util', 1670 1664 'phabricator-prefab', 1665 + ), 1666 + 'ab5f468d' => array( 1667 + 'javelin-dom', 1668 + 'javelin-util', 1669 + 'javelin-stratcom', 1670 + 'javelin-install', 1671 1671 ), 1672 1672 'b1a59974' => array( 1673 1673 'javelin-behavior',
+35 -31
src/applications/repository/query/PhabricatorRepositoryQuery.php
··· 10 10 private $uuids; 11 11 private $nameContains; 12 12 private $remoteURIs; 13 - private $anyProjectPHIDs; 14 13 private $datasourceQuery; 15 14 16 15 private $numericIdentifiers; ··· 99 98 return $this; 100 99 } 101 100 102 - public function withAnyProjects(array $projects) { 103 - $this->anyProjectPHIDs = $projects; 104 - return $this; 105 - } 106 - 107 101 public function withDatasourceQuery($query) { 108 102 $this->datasourceQuery = $query; 109 103 return $this; ··· 163 157 164 158 $data = queryfx_all( 165 159 $conn_r, 166 - 'SELECT * FROM %T r %Q %Q %Q %Q', 160 + '%Q FROM %T r %Q %Q %Q %Q %Q %Q', 161 + $this->buildSelectClause($conn_r), 167 162 $table->getTableName(), 168 - $this->buildJoinsClause($conn_r), 163 + $this->buildJoinClause($conn_r), 169 164 $this->buildWhereClause($conn_r), 165 + $this->buildGroupClause($conn_r), 166 + $this->buildHavingClause($conn_r), 170 167 $this->buildOrderClause($conn_r), 171 168 $this->buildLimitClause($conn_r)); 172 169 ··· 390 387 return $map; 391 388 } 392 389 393 - private function buildJoinsClause(AphrontDatabaseConnection $conn_r) { 394 - $joins = array(); 395 - 396 - $join_summary_table = $this->needCommitCounts || 397 - $this->needMostRecentCommits; 398 - 399 - $vector = $this->getOrderVector(); 400 - if ($vector->containsKey('committed') || 401 - $vector->containsKey('size')) { 402 - $join_summary_table = true; 390 + protected function buildSelectClause(AphrontDatabaseConnection $conn) { 391 + $parts = $this->buildSelectClauseParts($conn); 392 + if ($this->shouldJoinSummaryTable()) { 393 + $parts[] = 's.*'; 403 394 } 395 + return $this->formatSelectClause($parts); 396 + } 404 397 405 - if ($join_summary_table) { 398 + protected function buildJoinClause(AphrontDatabaseConnection $conn_r) { 399 + $joins = $this->buildJoinClauseParts($conn_r); 400 + 401 + if ($this->shouldJoinSummaryTable()) { 406 402 $joins[] = qsprintf( 407 403 $conn_r, 408 404 'LEFT JOIN %T s ON r.id = s.repositoryID', 409 405 PhabricatorRepository::TABLE_SUMMARY); 410 406 } 411 407 412 - if ($this->anyProjectPHIDs) { 413 - $joins[] = qsprintf( 414 - $conn_r, 415 - 'JOIN edge e ON e.src = r.phid'); 408 + return $this->formatJoinClause($joins); 409 + } 410 + 411 + private function shouldJoinSummaryTable() { 412 + if ($this->needCommitCounts) { 413 + return true; 416 414 } 417 415 418 - return implode(' ', $joins); 416 + if ($this->needMostRecentCommits) { 417 + return true; 418 + } 419 + 420 + $vector = $this->getOrderVector(); 421 + if ($vector->containsKey('committed')) { 422 + return true; 423 + } 424 + 425 + if ($vector->containsKey('size')) { 426 + return true; 427 + } 428 + 429 + return false; 419 430 } 420 431 421 432 protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { ··· 490 501 $conn_r, 491 502 'name LIKE %~', 492 503 $this->nameContains); 493 - } 494 - 495 - if ($this->anyProjectPHIDs) { 496 - $where[] = qsprintf( 497 - $conn_r, 498 - 'e.dst IN (%Ls)', 499 - $this->anyProjectPHIDs); 500 504 } 501 505 502 506 if (strlen($this->datasourceQuery)) {
+23 -10
src/applications/repository/query/PhabricatorRepositorySearchEngine.php
··· 20 20 $saved->setParameter('hosted', $request->getStr('hosted')); 21 21 $saved->setParameter('types', $request->getArr('types')); 22 22 $saved->setParameter('name', $request->getStr('name')); 23 - $saved->setParameter('anyProjectPHIDs', $request->getArr('anyProjects')); 23 + 24 + $saved->setParameter( 25 + 'projects', 26 + $this->readProjectsFromRequest($request, 'projects')); 24 27 25 28 return $saved; 26 29 } ··· 60 63 $query->withNameContains($name); 61 64 } 62 65 63 - $any_project_phids = $saved->getParameter('anyProjectPHIDs'); 64 - if ($any_project_phids) { 65 - $query->withAnyProjects($any_project_phids); 66 - } 66 + $adjusted = clone $saved; 67 + $adjusted->setParameter('projects', $this->readProjectTokens($saved)); 68 + $this->setQueryProjects($query, $adjusted); 67 69 68 70 return $query; 69 71 } ··· 76 78 $types = $saved_query->getParameter('types', array()); 77 79 $types = array_fuse($types); 78 80 $name = $saved_query->getParameter('name'); 79 - $any_project_phids = $saved_query->getParameter('anyProjectPHIDs', array()); 81 + $projects = $this->readProjectTokens($saved_query); 80 82 81 83 $form 82 84 ->appendChild( ··· 91 93 ->setValue($name)) 92 94 ->appendControl( 93 95 id(new AphrontFormTokenizerControl()) 94 - ->setDatasource(new PhabricatorProjectDatasource()) 95 - ->setName('anyProjects') 96 - ->setLabel(pht('In Any Project')) 97 - ->setValue($any_project_phids)) 96 + ->setDatasource(new PhabricatorProjectLogicalDatasource()) 97 + ->setName('projects') 98 + ->setLabel(pht('Projects')) 99 + ->setValue($projects)) 98 100 ->appendChild( 99 101 id(new AphrontFormSelectControl()) 100 102 ->setName('status') ··· 264 266 } 265 267 266 268 return $list; 269 + } 270 + 271 + private function readProjectTokens(PhabricatorSavedQuery $saved) { 272 + $projects = $saved->getParameter('projects', array()); 273 + 274 + $any = $saved->getParameter('anyProjectPHIDs', array()); 275 + foreach ($any as $project) { 276 + $projects[] = 'any('.$project.')'; 277 + } 278 + 279 + return $projects; 267 280 } 268 281 269 282 }