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

Showing tasks & diffs in the typeahead.

Summary: Trying to show tasks & diffs in the typeahead. My brain has got dumber as I have not been in touch with phab dev. Waiting for your comments and pointers.

Test Plan:
{F47352}
The tasks should show up in the type-ahead.

Reviewers: epriestley, Afaque_Hussain

Reviewed By: epriestley

CC: aran, Korvin, AnhNhan, blc

Maniphest Tasks: T2948

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

authored by

Afaque Hussain and committed by
epriestley
36f7ee50 f510edb9

+97 -41
+40 -40
src/__celerity_resource_map__.php
··· 2124 2124 ), 2125 2125 'javelin-behavior-phabricator-search-typeahead' => 2126 2126 array( 2127 - 'uri' => '/res/b39896d5/rsrc/js/core/behavior-search-typeahead.js', 2127 + 'uri' => '/res/439de76f/rsrc/js/core/behavior-search-typeahead.js', 2128 2128 'type' => 'js', 2129 2129 'requires' => 2130 2130 array( ··· 4173 4173 'uri' => '/res/pkg/178f5351/core.pkg.css', 4174 4174 'type' => 'css', 4175 4175 ), 4176 - '0b587556' => 4176 + '75ccea43' => 4177 4177 array( 4178 4178 'name' => 'core.pkg.js', 4179 4179 'symbols' => ··· 4216 4216 35 => 'phabricator-hovercard', 4217 4217 36 => 'javelin-behavior-phabricator-hovercards', 4218 4218 ), 4219 - 'uri' => '/res/pkg/0b587556/core.pkg.js', 4219 + 'uri' => '/res/pkg/75ccea43/core.pkg.js', 4220 4220 'type' => 'js', 4221 4221 ), 4222 4222 '4ccfeb47' => ··· 4389 4389 'diffusion-icons-css' => 'c8ce2d88', 4390 4390 'global-drag-and-drop-css' => '178f5351', 4391 4391 'inline-comment-summary-css' => 'dd27a69b', 4392 - 'javelin-aphlict' => '0b587556', 4392 + 'javelin-aphlict' => '75ccea43', 4393 4393 'javelin-behavior' => 'a9f14d76', 4394 - 'javelin-behavior-aphlict-dropdown' => '0b587556', 4395 - 'javelin-behavior-aphlict-listen' => '0b587556', 4396 - 'javelin-behavior-aphront-basic-tokenizer' => '0b587556', 4394 + 'javelin-behavior-aphlict-dropdown' => '75ccea43', 4395 + 'javelin-behavior-aphlict-listen' => '75ccea43', 4396 + 'javelin-behavior-aphront-basic-tokenizer' => '75ccea43', 4397 4397 'javelin-behavior-aphront-drag-and-drop' => '9488bb69', 4398 4398 'javelin-behavior-aphront-drag-and-drop-textarea' => '9488bb69', 4399 - 'javelin-behavior-aphront-form-disable-on-submit' => '0b587556', 4399 + 'javelin-behavior-aphront-form-disable-on-submit' => '75ccea43', 4400 4400 'javelin-behavior-audit-preview' => '96909266', 4401 4401 'javelin-behavior-dark-console' => '4ccfeb47', 4402 - 'javelin-behavior-device' => '0b587556', 4402 + 'javelin-behavior-device' => '75ccea43', 4403 4403 'javelin-behavior-differential-accept-with-errors' => '9488bb69', 4404 4404 'javelin-behavior-differential-add-reviewers-and-ccs' => '9488bb69', 4405 4405 'javelin-behavior-differential-comment-jump' => '9488bb69', ··· 4415 4415 'javelin-behavior-diffusion-commit-graph' => '96909266', 4416 4416 'javelin-behavior-diffusion-pull-lastmodified' => '96909266', 4417 4417 'javelin-behavior-error-log' => '4ccfeb47', 4418 - 'javelin-behavior-global-drag-and-drop' => '0b587556', 4419 - 'javelin-behavior-history-install' => '0b587556', 4420 - 'javelin-behavior-konami' => '0b587556', 4421 - 'javelin-behavior-lightbox-attachments' => '0b587556', 4418 + 'javelin-behavior-global-drag-and-drop' => '75ccea43', 4419 + 'javelin-behavior-history-install' => '75ccea43', 4420 + 'javelin-behavior-konami' => '75ccea43', 4421 + 'javelin-behavior-lightbox-attachments' => '75ccea43', 4422 4422 'javelin-behavior-load-blame' => '9488bb69', 4423 4423 'javelin-behavior-maniphest-batch-selector' => '98f64f07', 4424 4424 'javelin-behavior-maniphest-subpriority-editor' => '98f64f07', 4425 4425 'javelin-behavior-maniphest-transaction-controls' => '98f64f07', 4426 4426 'javelin-behavior-maniphest-transaction-expand' => '98f64f07', 4427 4427 'javelin-behavior-maniphest-transaction-preview' => '98f64f07', 4428 - 'javelin-behavior-phabricator-active-nav' => '0b587556', 4429 - 'javelin-behavior-phabricator-autofocus' => '0b587556', 4430 - 'javelin-behavior-phabricator-gesture' => '0b587556', 4431 - 'javelin-behavior-phabricator-hovercards' => '0b587556', 4432 - 'javelin-behavior-phabricator-keyboard-shortcuts' => '0b587556', 4433 - 'javelin-behavior-phabricator-nav' => '0b587556', 4428 + 'javelin-behavior-phabricator-active-nav' => '75ccea43', 4429 + 'javelin-behavior-phabricator-autofocus' => '75ccea43', 4430 + 'javelin-behavior-phabricator-gesture' => '75ccea43', 4431 + 'javelin-behavior-phabricator-hovercards' => '75ccea43', 4432 + 'javelin-behavior-phabricator-keyboard-shortcuts' => '75ccea43', 4433 + 'javelin-behavior-phabricator-nav' => '75ccea43', 4434 4434 'javelin-behavior-phabricator-object-selector' => '9488bb69', 4435 - 'javelin-behavior-phabricator-oncopy' => '0b587556', 4436 - 'javelin-behavior-phabricator-remarkup-assist' => '0b587556', 4437 - 'javelin-behavior-phabricator-reveal-content' => '0b587556', 4438 - 'javelin-behavior-phabricator-search-typeahead' => '0b587556', 4439 - 'javelin-behavior-phabricator-tooltips' => '0b587556', 4440 - 'javelin-behavior-phabricator-watch-anchor' => '0b587556', 4441 - 'javelin-behavior-refresh-csrf' => '0b587556', 4435 + 'javelin-behavior-phabricator-oncopy' => '75ccea43', 4436 + 'javelin-behavior-phabricator-remarkup-assist' => '75ccea43', 4437 + 'javelin-behavior-phabricator-reveal-content' => '75ccea43', 4438 + 'javelin-behavior-phabricator-search-typeahead' => '75ccea43', 4439 + 'javelin-behavior-phabricator-tooltips' => '75ccea43', 4440 + 'javelin-behavior-phabricator-watch-anchor' => '75ccea43', 4441 + 'javelin-behavior-refresh-csrf' => '75ccea43', 4442 4442 'javelin-behavior-repository-crossreference' => '9488bb69', 4443 - 'javelin-behavior-toggle-class' => '0b587556', 4444 - 'javelin-behavior-workflow' => '0b587556', 4443 + 'javelin-behavior-toggle-class' => '75ccea43', 4444 + 'javelin-behavior-workflow' => '75ccea43', 4445 4445 'javelin-dom' => 'a9f14d76', 4446 4446 'javelin-event' => 'a9f14d76', 4447 4447 'javelin-history' => 'a9f14d76', ··· 4466 4466 'maniphest-transaction-detail-css' => 'adc3c36d', 4467 4467 'phabricator-action-list-view-css' => '178f5351', 4468 4468 'phabricator-application-launch-view-css' => '178f5351', 4469 - 'phabricator-busy' => '0b587556', 4469 + 'phabricator-busy' => '75ccea43', 4470 4470 'phabricator-content-source-view-css' => 'dd27a69b', 4471 4471 'phabricator-core-css' => '178f5351', 4472 4472 'phabricator-crumbs-view-css' => '178f5351', 4473 4473 'phabricator-drag-and-drop-file-upload' => '9488bb69', 4474 - 'phabricator-dropdown-menu' => '0b587556', 4475 - 'phabricator-file-upload' => '0b587556', 4474 + 'phabricator-dropdown-menu' => '75ccea43', 4475 + 'phabricator-file-upload' => '75ccea43', 4476 4476 'phabricator-filetree-view-css' => '178f5351', 4477 4477 'phabricator-flag-css' => '178f5351', 4478 4478 'phabricator-form-view-css' => '178f5351', 4479 4479 'phabricator-header-view-css' => '178f5351', 4480 - 'phabricator-hovercard' => '0b587556', 4480 + 'phabricator-hovercard' => '75ccea43', 4481 4481 'phabricator-jump-nav' => '178f5351', 4482 - 'phabricator-keyboard-shortcut' => '0b587556', 4483 - 'phabricator-keyboard-shortcut-manager' => '0b587556', 4482 + 'phabricator-keyboard-shortcut' => '75ccea43', 4483 + 'phabricator-keyboard-shortcut-manager' => '75ccea43', 4484 4484 'phabricator-main-menu-view' => '178f5351', 4485 - 'phabricator-menu-item' => '0b587556', 4485 + 'phabricator-menu-item' => '75ccea43', 4486 4486 'phabricator-nav-view-css' => '178f5351', 4487 - 'phabricator-notification' => '0b587556', 4487 + 'phabricator-notification' => '75ccea43', 4488 4488 'phabricator-notification-css' => '178f5351', 4489 4489 'phabricator-notification-menu-css' => '178f5351', 4490 4490 'phabricator-object-item-list-view-css' => '178f5351', 4491 4491 'phabricator-object-selector-css' => 'dd27a69b', 4492 - 'phabricator-phtize' => '0b587556', 4493 - 'phabricator-prefab' => '0b587556', 4492 + 'phabricator-phtize' => '75ccea43', 4493 + 'phabricator-prefab' => '75ccea43', 4494 4494 'phabricator-project-tag-css' => 'adc3c36d', 4495 4495 'phabricator-property-list-view-css' => '178f5351', 4496 4496 'phabricator-remarkup-css' => '178f5351', ··· 4498 4498 'phabricator-side-menu-view-css' => '178f5351', 4499 4499 'phabricator-standard-page-view' => '178f5351', 4500 4500 'phabricator-tag-view-css' => '178f5351', 4501 - 'phabricator-textareautils' => '0b587556', 4502 - 'phabricator-tooltip' => '0b587556', 4501 + 'phabricator-textareautils' => '75ccea43', 4502 + 'phabricator-tooltip' => '75ccea43', 4503 4503 'phabricator-transaction-view-css' => '178f5351', 4504 4504 'phabricator-zindex-css' => '178f5351', 4505 4505 'phui-button-css' => '178f5351',
+56
src/applications/typeahead/controller/PhabricatorTypeaheadCommonDatasourceController.php
··· 29 29 $need_arcanist_projects = false; 30 30 $need_noproject = false; 31 31 $need_symbols = false; 32 + $need_jump_objects = false; 32 33 switch ($this->type) { 33 34 case 'mainsearch': 34 35 $need_users = true; ··· 36 37 $need_rich_data = true; 37 38 $need_symbols = true; 38 39 $need_projs = true; 40 + $need_jump_objects = true; 39 41 break; 40 42 case 'searchowner': 41 43 $need_users = true; ··· 296 298 ->setDisplayName($name) 297 299 ->setDisplayType(strtoupper($lang).' '.ucwords($type).' ('.$proj.')') 298 300 ->setPriorityType('symb'); 301 + } 302 + } 303 + 304 + if ($need_jump_objects) { 305 + $response = PhabricatorJumpNavHandler::jumpPostResponse($query); 306 + 307 + if ($response) { 308 + $is_task = array(); 309 + $is_revision = array(); 310 + 311 + preg_match('/T[0-9]+/', $response->getURI(), $is_task); 312 + preg_match('/D[0-9]+/', $response->getURI(), $is_revision); 313 + 314 + if ($is_task) { 315 + for ($i = 0; $i < count($is_task); $i++) { 316 + $is_task[$i] = substr($is_task[$i], 1); // Remove leading 'T'. 317 + } 318 + $tasks = id(new ManiphestTaskQuery()) 319 + ->setViewer($viewer) 320 + ->withTaskIDs($is_task) 321 + ->execute(); 322 + 323 + if ($tasks) { 324 + foreach ($tasks as $task) { 325 + $results[] = id(new PhabricatorTypeaheadResult()) 326 + ->setName('T'.$task->getID()) 327 + ->setDisplayType("Task") 328 + ->setURI('/T'.$task->getID()) 329 + ->setPHID($task->getPHID()) 330 + ->setPriorityType('jump'); 331 + } 332 + } 333 + } 334 + 335 + if ($is_revision) { 336 + for ($i = 0; $i < count($is_revision); $i++) { 337 + $is_revision[$i] = substr($is_revision[$i], 1); 338 + } 339 + $revisions = id(new DifferentialRevisionQuery()) 340 + ->setViewer($viewer) 341 + ->withIDs($is_revision) 342 + ->execute(); 343 + 344 + if ($revisions) { 345 + foreach ($revisions as $revision) { 346 + $results[] = id(new PhabricatorTypeaheadResult()) 347 + ->setName('D'.$revision->getID()) 348 + ->setDisplayType("Revision") 349 + ->setURI('/D'.$revision->getID()) 350 + ->setPHID($revision->getPHID()) 351 + ->setPriorityType('jump'); 352 + } 353 + } 354 + } 299 355 } 300 356 } 301 357
+1 -1
webroot/rsrc/js/core/behavior-search-typeahead.js
··· 51 51 var sort_handler = function(value, list, cmp) { 52 52 var priority_hits = {}; 53 53 var type_priority = { 54 - // TODO: Put jump nav hits like "D123" first. 54 + 'jump' : 1, 55 55 'apps' : 2, 56 56 'user' : 3, 57 57 'symb' : 4